Safe Haskell | None |
---|
- data ConnectionType
- connectBus :: ConnectionType -> MethodCallHandler -> SignalHandler -> IO DBusConnection
- type MethodCallHandler = DBusConnection -> MessageHeader -> [SomeDBusValue] -> IO ()
- type SignalHandler = DBusConnection -> MessageHeader -> [SomeDBusValue] -> IO ()
- checkAlive :: DBusConnection -> IO Bool
- waitFor :: DBusConnection -> IO ()
- objectRoot :: Object -> Handler
- data MatchRule = MatchRule {
- mrType :: Maybe MessageType
- mrSender :: Maybe Text
- mrInterface :: Maybe Text
- mrMember :: Maybe Text
- mrPath :: Maybe (Bool, ObjectPath)
- mrDestination :: Maybe Text
- mrArgs :: [(Int, Text)]
- mrArgPaths :: [(Int, Text)]
- mrArg0namespace :: Maybe Text
- mrEavesdrop :: Maybe Bool
- matchAll :: MatchRule
- matchSignal :: MessageHeader -> MatchRule -> Bool
- addMatch :: (MonadIO m, MonadThrow m) => MatchRule -> DBusConnection -> m ()
- removeMatch :: (MonadIO m, MonadThrow m) => MatchRule -> DBusConnection -> m ()
- class Representable a where
- makeRepresentable :: Name -> Q [Dec]
- makeRepresentableTuple :: Int -> Q Dec
- data DBusValue where
- DBVByte :: Word8 -> DBusValue (DBusSimpleType TypeByte)
- DBVBool :: Bool -> DBusValue (DBusSimpleType TypeBoolean)
- DBVInt16 :: Int16 -> DBusValue (DBusSimpleType TypeInt16)
- DBVUInt16 :: Word16 -> DBusValue (DBusSimpleType TypeUInt16)
- DBVInt32 :: Int32 -> DBusValue (DBusSimpleType TypeInt32)
- DBVUInt32 :: Word32 -> DBusValue (DBusSimpleType TypeUInt32)
- DBVInt64 :: Int64 -> DBusValue (DBusSimpleType TypeInt64)
- DBVUInt64 :: Word64 -> DBusValue (DBusSimpleType TypeUInt64)
- DBVDouble :: Double -> DBusValue (DBusSimpleType TypeDouble)
- DBVUnixFD :: Word32 -> DBusValue (DBusSimpleType TypeUnixFD)
- DBVString :: Text -> DBusValue (DBusSimpleType TypeString)
- DBVObjectPath :: ObjectPath -> DBusValue (DBusSimpleType TypeObjectPath)
- DBVSignature :: [DBusType] -> DBusValue (DBusSimpleType TypeSignature)
- DBVVariant :: SingI t => DBusValue t -> DBusValue TypeVariant
- DBVArray :: [DBusValue a] -> DBusValue (TypeArray a)
- DBVByteArray :: ByteString -> DBusValue (TypeArray (DBusSimpleType TypeByte))
- DBVStruct :: DBusStruct ts -> DBusValue (TypeStruct ts)
- DBVDict :: [(DBusValue (DBusSimpleType k), DBusValue v)] -> DBusValue (TypeDict k v)
- DBVUnit :: DBusValue TypeUnit
- castDBV :: (SingI s, SingI t) => DBusValue s -> Maybe (DBusValue t)
- data DBusStruct where
- StructSingleton :: DBusValue a -> DBusStruct `[a]`
- StructCons :: DBusValue a -> DBusStruct as -> DBusStruct (a : as)
- data SomeDBusValue where
- DBV :: SingI t => DBusValue t -> SomeDBusValue
- dbusValue :: SingI t => SomeDBusValue -> Maybe (DBusValue t)
- fromVariant :: SingI t => DBusValue TypeVariant -> Maybe (DBusValue t)
- data DBusSimpleType
- = TypeByte
- | TypeBoolean
- | TypeInt16
- | TypeUInt16
- | TypeInt32
- | TypeUInt32
- | TypeInt64
- | TypeUInt64
- | TypeDouble
- | TypeUnixFD
- | TypeString
- | TypeObjectPath
- | TypeSignature
- data DBusType
- newtype Signature = Signature {
- fromSignature :: [DBusType]
- typeOf :: SingI t => DBusValue t -> DBusType
- data ObjectPath
- objectPath :: Text -> ObjectPath
- objectPathToText :: ObjectPath -> Text
- stripObjectPrefix :: ObjectPath -> ObjectPath -> Maybe ObjectPath
- isPathPrefix :: ObjectPath -> ObjectPath -> Bool
- isRoot :: ObjectPath -> Bool
- isEmpty :: ObjectPath -> Bool
- data Method where
- Method :: (SingI avs, SingI t) => MethodWrapper avs t -> Text -> MethodDescription (ArgParity avs) -> Method
- data MethodWrapper av rv where
- MReturn :: SingI t => IO (DBusValue t) -> MethodWrapper `[]` t
- MAsk :: SingI t => (DBusValue t -> MethodWrapper avs rv) -> MethodWrapper (t : avs) rv
- repMethod :: RepMethod f => f -> MethodWrapper (RepMethodArgs f) (RepMethodValue f)
- callMethod :: Text -> ObjectPath -> Text -> Text -> [SomeDBusValue] -> [Flag] -> DBusConnection -> IO (STM (Either [SomeDBusValue] SomeDBusValue))
- callMethod' :: (SingI (RepType a), Representable a, MonadThrow m, MonadIO m) => Text -> ObjectPath -> Text -> Text -> [SomeDBusValue] -> [Flag] -> DBusConnection -> m a
- addIntrospectable :: Object -> Object
- requestName :: (MonadIO m, MonadThrow m) => Text -> RequestNameFlag -> DBusConnection -> m RequestNameReply
- data RequestNameFlag = RequestNameFlag {}
- data RequestNameReply
- = PrimaryOwner
- | InQueue
- | Exists
- | AlreadyOwner
- releaseName :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m ReleaseNameReply
- data ReleaseNameReply
- = Released
- | NonExistent
- | NotOwner
- listQueuedOwners :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m [Text]
- listNames :: (MonadIO m, MonadThrow m) => DBusConnection -> m [Text]
- listActivatableNames :: (MonadIO m, MonadThrow m) => DBusConnection -> m [Text]
- nameHasOwner :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m Bool
- startServiceByName :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m StartServiceResult
- getNameOwner :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m Text
- getConnectionUnixUser :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m Word32
- getConnectionProcessID :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m Word32
- getID :: (MonadIO m, MonadThrow m) => DBusConnection -> m Text
Connection management
data ConnectionType Source
Which Bus to connect to
Session | The well-known system bus. First the environmental variable DBUS_SESSION_BUS_ADDRESS is checked and if it doesn't exist the address unix:path=\var/run/dbus/system_bus_socket/ is used |
System | The well-known system bus. Refers to the address stored in the environmental variable DBUS_SESSION_BUS_ADDRESS |
Address String | The bus at the give addresss |
:: ConnectionType | Bus to connect to |
-> MethodCallHandler | Handler for incoming method calls |
-> SignalHandler | Handler for incoming signals |
-> IO DBusConnection |
Create a new connection to a message bus
type MethodCallHandler = DBusConnection -> MessageHeader -> [SomeDBusValue] -> IO ()Source
type SignalHandler = DBusConnection -> MessageHeader -> [SomeDBusValue] -> IO ()Source
checkAlive :: DBusConnection -> IO BoolSource
Check whether connection is alive
waitFor :: DBusConnection -> IO ()Source
Wait until connection is closed
Message handling
objectRoot :: Object -> HandlerSource
Create a message handler that dispatches matches to the methods in a root object
Signals
MatchRule | |
|
matchSignal :: MessageHeader -> MatchRule -> BoolSource
Match a Signal against a rule. The argN, argNPath and arg0namespace parameter are ignored at the moment
addMatch :: (MonadIO m, MonadThrow m) => MatchRule -> DBusConnection -> m ()Source
removeMatch :: (MonadIO m, MonadThrow m) => MatchRule -> DBusConnection -> m ()Source
Representable Types
class Representable a whereSource
makeRepresentable :: Name -> Q [Dec]Source
makeRepresentableTuple :: Int -> Q DecSource
DBus specific types
DBus Values
data DBusStruct whereSource
StructSingleton :: DBusValue a -> DBusStruct `[a]` | |
StructCons :: DBusValue a -> DBusStruct as -> DBusStruct (a : as) |
Eq (DBusStruct t) | |
SingI [DBusType] a => Show (DBusStruct a) |
dbusValue :: SingI t => SomeDBusValue -> Maybe (DBusValue t)Source
fromVariant :: SingI t => DBusValue TypeVariant -> Maybe (DBusValue t)Source
Extract a DBusValue from a Variant iff the type matches or return nothing
Signature
data DBusSimpleType Source
TypeByte | |
TypeBoolean | |
TypeInt16 | |
TypeUInt16 | |
TypeInt32 | |
TypeUInt32 | |
TypeInt64 | |
TypeUInt64 | |
TypeDouble | |
TypeUnixFD | |
TypeString | |
TypeObjectPath | |
TypeSignature |
Eq DBusSimpleType | |
Data DBusSimpleType | |
Read DBusSimpleType | |
Show DBusSimpleType | |
Typeable DBusSimpleType | |
SingI DBusSimpleType TypeSignature | |
SingI DBusSimpleType TypeObjectPath | |
SingI DBusSimpleType TypeString | |
SingI DBusSimpleType TypeUnixFD | |
SingI DBusSimpleType TypeDouble | |
SingI DBusSimpleType TypeUInt64 | |
SingI DBusSimpleType TypeInt64 | |
SingI DBusSimpleType TypeUInt32 | |
SingI DBusSimpleType TypeInt32 | |
SingI DBusSimpleType TypeUInt16 | |
SingI DBusSimpleType TypeInt16 | |
SingI DBusSimpleType TypeBoolean | |
SingI DBusSimpleType TypeByte | |
SingKind DBusSimpleType (KProxy DBusSimpleType) | |
SEq DBusSimpleType (KProxy DBusSimpleType) |
DBusSimpleType DBusSimpleType | |
TypeArray DBusType | |
TypeStruct [DBusType] | |
TypeDict DBusSimpleType DBusType | |
TypeVariant | |
TypeDictEntry DBusSimpleType DBusType | |
TypeUnit |
Eq DBusType | |
Data DBusType | |
Read DBusType | |
Show DBusType | |
Typeable DBusType | |
SingI DBusType TypeUnit | |
SingI DBusType TypeVariant | |
SingKind DBusType (KProxy DBusType) | |
SingI [DBusType] n0 => SingI DBusType (TypeStruct n0) | |
SingI DBusType n0 => SingI DBusType (TypeArray n0) | |
SingI DBusSimpleType n0 => SingI DBusType (DBusSimpleType n0) | |
SEq DBusType (KProxy DBusType) | |
(SingI DBusSimpleType n0, SingI DBusType n1) => SingI DBusType (TypeDictEntry n0 n1) | |
(SingI DBusSimpleType n0, SingI DBusType n1) => SingI DBusType (TypeDict n0 n1) |
ObjectPath
data ObjectPath Source
objectPath :: Text -> ObjectPathSource
Parse an object path. Contrary to the standard, empty path parts are ignored
isPathPrefix :: ObjectPath -> ObjectPath -> BoolSource
isRoot :: ObjectPath -> BoolSource
isEmpty :: ObjectPath -> BoolSource
Methods
Method :: (SingI avs, SingI t) => MethodWrapper avs t -> Text -> MethodDescription (ArgParity avs) -> Method |
data MethodWrapper av rv whereSource
MReturn :: SingI t => IO (DBusValue t) -> MethodWrapper `[]` t | |
MAsk :: SingI t => (DBusValue t -> MethodWrapper avs rv) -> MethodWrapper (t : avs) rv |
repMethod :: RepMethod f => f -> MethodWrapper (RepMethodArgs f) (RepMethodValue f)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. Returns an STM action that waits for the returned value.
:: (SingI (RepType a), Representable a, MonadThrow m, MonadIO m) | |
=> Text | Entity to send the message to |
-> ObjectPath | Object |
-> Text | Interface |
-> Text | Member (method) to call |
-> [SomeDBusValue] | Arguments |
-> [Flag] | Method call flags |
-> DBusConnection | Connection to send the call over |
-> m a |
Synchronously call a method. Returned errors are thrown as MethodError
s.
If the returned value's type doesn't match the expected type a
MethodSignatureMissmatch
is thrown.
Introspection
Message Bus
requestName :: (MonadIO m, MonadThrow m) => Text -> RequestNameFlag -> DBusConnection -> m RequestNameReplySource
data RequestNameFlag Source
releaseName :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m ReleaseNameReplySource
listQueuedOwners :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m [Text]Source
listNames :: (MonadIO m, MonadThrow m) => DBusConnection -> m [Text]Source
listActivatableNames :: (MonadIO m, MonadThrow m) => DBusConnection -> m [Text]Source
nameHasOwner :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m BoolSource
startServiceByName :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m StartServiceResultSource
getNameOwner :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m TextSource
getConnectionUnixUser :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m Word32Source
getConnectionProcessID :: (MonadIO m, MonadThrow m) => Text -> DBusConnection -> m Word32Source
getID :: (MonadIO m, MonadThrow m) => DBusConnection -> m TextSource