Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data MessageType
- data Flag
- newtype Flags = Flags [Flag]
- fromFlags :: (Num a, Ord a, Bits a) => a -> [Flag]
- data HeaderFields = HeaderFields {}
- emptyHeaderFields :: HeaderFields
- toFields :: HeaderFields -> [HeaderField]
- fromFields :: [HeaderField] -> HeaderFields
- data HeaderField
- data MessageHeader = MessageHeader {
- endianessFlag :: Endian
- messageType :: MessageType
- flags :: Flags
- version :: Word8
- messageLength :: Word32
- serial :: Word32
- fields :: HeaderFields
- methodCall :: Word32 -> Text -> ObjectPath -> Text -> Text -> [SomeDBusValue] -> [Flag] -> Builder
- mkSignal :: SingI ts => Word32 -> [Flag] -> Signal ts -> Builder
- methodReturn :: Word32 -> Word32 -> Text -> SomeDBusArguments -> Builder
- errorMessage :: Word32 -> Maybe Word32 -> Text -> Text -> Maybe Text -> [SomeDBusValue] -> Builder
- serializeMessage :: MessageHeader -> [SomeDBusValue] -> Builder
- getMessage :: Get (MessageHeader, [SomeDBusValue])
- parseMessages :: MonadThrow m => ConduitM ByteString (MessageHeader, [SomeDBusValue]) m b
- sendBS :: DBusConnection -> Builder -> IO ()
- callMethod' :: Text -> ObjectPath -> Text -> Text -> [SomeDBusValue] -> [Flag] -> DBusConnection -> IO (STM (Either [SomeDBusValue] [SomeDBusValue]))
- toArgs :: Representable args => args -> [SomeDBusValue]
- fromResponse :: Representable a => Either [SomeDBusValue] [SomeDBusValue] -> Either MethodError a
- callMethod :: (Representable args, Representable ret) => Text -> ObjectPath -> Text -> Text -> args -> [Flag] -> DBusConnection -> IO (Either MethodError ret)
- callAsync :: (Representable args, Representable ret) => MethodDescription (FlattenRepType (RepType args)) (FlattenRepType (RepType ret)) -> Text -> args -> [Flag] -> DBusConnection -> IO (STM (Either MethodError ret))
- call :: (Representable ret, Representable args) => MethodDescription (FlattenRepType (RepType args)) (FlattenRepType (RepType ret)) -> Text -> args -> [Flag] -> DBusConnection -> IO (Either MethodError ret)
Documentation
data MessageType Source
data HeaderFields Source
HeaderFields | |
|
toFields :: HeaderFields -> [HeaderField] Source
fromFields :: [HeaderField] -> HeaderFields Source
data HeaderField Source
Eq HeaderField Source | |
Show HeaderField Source | |
Representable HeaderField Source | |
type RepType HeaderField = TypeStruct ((:) DBusType (DBusSimpleType TypeByte) ((:) DBusType TypeVariant ([] DBusType))) Source |
data MessageHeader Source
MessageHeader | |
|
Eq MessageHeader Source | |
Show MessageHeader Source | |
Representable MessageHeader Source | |
type RepType MessageHeader = TypeStruct ((:) DBusType (RepType Endian) ((:) DBusType (RepType MessageType) ((:) DBusType (RepType Flags) ((:) DBusType (RepType Word8) ((:) DBusType (RepType Word32) ((:) DBusType (RepType Word32) ((:) DBusType (RepType HeaderFields) ([] DBusType)))))))) Source |
methodCall :: Word32 -> Text -> ObjectPath -> Text -> Text -> [SomeDBusValue] -> [Flag] -> Builder Source
methodReturn :: Word32 -> Word32 -> Text -> SomeDBusArguments -> Builder Source
errorMessage :: Word32 -> Maybe Word32 -> Text -> Text -> Maybe Text -> [SomeDBusValue] -> Builder Source
serializeMessage :: MessageHeader -> [SomeDBusValue] -> Builder Source
getMessage :: Get (MessageHeader, [SomeDBusValue]) Source
parseMessages :: MonadThrow m => ConduitM ByteString (MessageHeader, [SomeDBusValue]) m b Source
sendBS :: DBusConnection -> Builder -> IO () Source
:: Text | Entity to send the message to |
-> ObjectPath | Object |
-> Text | Interface |
-> Text | Member (method) name |
-> [SomeDBusValue] | Arguments |
-> [Flag] | Method call flags |
-> DBusConnection | Connection to send the call over |
-> IO (STM (Either [SomeDBusValue] [SomeDBusValue])) |
Asychronously call a method.
This is the "raw" version of callMethod
. It doesn't do argument conversion.
toArgs :: Representable args => args -> [SomeDBusValue] Source
fromResponse :: Representable a => Either [SomeDBusValue] [SomeDBusValue] -> Either MethodError a Source
Try to convert the response to a method call top Haskell types
:: (Representable args, Representable ret) | |
=> Text | Entity to send the message to |
-> ObjectPath | Object |
-> Text | Interface |
-> Text | Member (method) to call |
-> args | Arguments |
-> [Flag] | Method call flags |
-> DBusConnection | Connection to send the call over |
-> IO (Either MethodError ret) |
Synchronously call a method.
This is the "cooked" version of callMethod''. It automatically converts arguments and returns values.
If the returned value's type doesn't match the expected type a
MethodSignatureMissmatch
is returned
You can pass in and extract multiple arguments and return values with types that are represented by DBus Structs (e.g. tuples). More specifically, multiple arguments/return values are handled in the following way:
- If the method returns multiple values and the RepType of the expected return value is a struct it tries to match up the arguments with the struct fields
- If the method returns a single struct and the RepType is a struct it will try to match up those two
- If the RepType of the expected return value is not a struct it will only match if the method returned exactly one value and those two match up (as per normal)
This means that if the RepType of the expected return value is a struct it might be matched in two ways: Either by the method returning multiple values or the method returning a single struct. At the moment there is no way to exclude either
callAsync :: (Representable args, Representable ret) => MethodDescription (FlattenRepType (RepType args)) (FlattenRepType (RepType ret)) -> Text -> args -> [Flag] -> DBusConnection -> IO (STM (Either MethodError ret)) Source
call :: (Representable ret, Representable args) => MethodDescription (FlattenRepType (RepType args)) (FlattenRepType (RepType ret)) -> Text -> args -> [Flag] -> DBusConnection -> IO (Either MethodError ret) Source