-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Small DBus implementation -- -- Small and flexible implementation of the dbus protocol. @package udbus @version 0.2.2 module Network.DBus.Actions data DBusContext data DBusTransport DBusTransport :: (Int -> IO ByteString) -> (ByteString -> IO ()) -> IO () -> DBusTransport [transportGet] :: DBusTransport -> Int -> IO ByteString [transportPut] :: DBusTransport -> ByteString -> IO () [transportClose] :: DBusTransport -> IO () -- | authenticate to DBus using a raw bytestring. authenticate :: DBusContext -> ByteString -> IO () -- | authenticate to DBus using a UID. authenticateUID :: DBusContext -> Int -> IO () -- | connect to the dbus session bus define by the environment variable -- DBUS_SESSION_BUS_ADDRESS connectSession :: IO Handle -- | connect to the dbus system bus connectSystem :: IO Handle -- | create a new DBus context from an handle contextNew :: Handle -> IO DBusContext -- | create a new DBus context from a transport contextNewWith :: DBusTransport -> IO DBusContext -- | create a new DBus context on session bus busGetSession :: IO DBusContext -- | create a new DBus context on system bus busGetSystem :: IO DBusContext -- | get the next serial usable, and increment the serial state. busGetNextSerial :: DBusContext -> IO Serial -- | close this DBus context busClose :: DBusContext -> IO () -- | send one message to the bus note that the serial of the message sent -- is allocated here. messageSend :: DBusContext -> DBusMessage -> IO Serial -- | send one message to the bus with a predefined serial number. messageSendWithSerial :: DBusContext -> Serial -> DBusMessage -> IO () -- | receive one single message from the bus it is not necessarily the -- reply from a previous sent message. messageRecv :: DBusContext -> IO DBusMessage -- | dbus message types data MessageType TypeInvalid :: MessageType TypeMethodCall :: MessageType TypeMethodReturn :: MessageType TypeError :: MessageType TypeSignal :: MessageType -- | dbus message flags data MessageFlag FlagNoReplyExpected :: MessageFlag FlagNoAutoStart :: MessageFlag data DBusFields DBusFields :: Maybe ObjectPath -> Maybe Interface -> Maybe Member -> Maybe ErrorName -> Maybe Serial -> Maybe BusName -> Maybe BusName -> Signature -> Maybe UnixFD -> DBusFields [fieldsPath] :: DBusFields -> Maybe ObjectPath [fieldsInterface] :: DBusFields -> Maybe Interface [fieldsMember] :: DBusFields -> Maybe Member [fieldsErrorName] :: DBusFields -> Maybe ErrorName [fieldsReplySerial] :: DBusFields -> Maybe Serial [fieldsDestination] :: DBusFields -> Maybe BusName [fieldsSender] :: DBusFields -> Maybe BusName [fieldsSignature] :: DBusFields -> Signature [fieldsUnixFD] :: DBusFields -> Maybe UnixFD data DBusMessage DBusMessage :: DBusEndian -> !MessageType -> !Int -> !Int -> !Serial -> DBusFields -> ByteString -> DBusMessage [msgEndian] :: DBusMessage -> DBusEndian [msgType] :: DBusMessage -> !MessageType [msgVersion] :: DBusMessage -> !Int [msgFlags] :: DBusMessage -> !Int [msgSerial] :: DBusMessage -> !Serial [msgFields] :: DBusMessage -> DBusFields [msgBodyRaw] :: DBusMessage -> ByteString -- | dbus serial number type Serial = Word32 -- | read message's body using the signature field as reference readBody :: DBusMessage -> Body -- | read message's body with a defined signature readBodyWith :: DBusMessage -> Signature -> Body -- | One possible signature element data Type SigByte :: Type SigBool :: Type SigInt16 :: Type SigUInt16 :: Type SigInt32 :: Type SigUInt32 :: Type SigInt64 :: Type SigUInt64 :: Type SigDouble :: Type SigString :: Type SigObjectPath :: Type SigSignature :: Type SigArray :: Type -> Type SigStruct :: [Type] -> Type SigVariant :: Type SigDict :: Type -> Type -> Type SigUnixFD :: Type -- | Deprecated: use Type instead type SignatureElem = Type -- | A list of signature element type Signature = [Type] -- | serialize a signature serializeSignature :: Signature -> ByteString -- | unserialize a signature unserializeSignature :: ByteString -> Either String Signature newtype ObjectPath ObjectPath :: String -> ObjectPath [unObjectPath] :: ObjectPath -> String newtype PackedString PackedString :: ByteString -> PackedString [ustringToBS] :: PackedString -> ByteString packedStringToString :: PackedString -> String -- | DBus Types data DBusValue DBusByte :: Word8 -> DBusValue DBusBoolean :: Bool -> DBusValue DBusInt16 :: Int16 -> DBusValue DBusUInt16 :: Word16 -> DBusValue DBusInt32 :: Int32 -> DBusValue DBusUInt32 :: Word32 -> DBusValue DBusInt64 :: Int64 -> DBusValue DBusUInt64 :: Word64 -> DBusValue DBusDouble :: Double -> DBusValue DBusString :: PackedString -> DBusValue DBusObjectPath :: ObjectPath -> DBusValue DBusSignature :: Signature -> DBusValue DBusByteArray :: ByteString -> DBusValue DBusArray :: Type -> [DBusValue] -> DBusValue DBusStruct :: Signature -> [DBusValue] -> DBusValue DBusDict :: DBusValue -> DBusValue -> DBusValue DBusVariant :: DBusValue -> DBusValue DBusUnixFD :: Word32 -> DBusValue class DBusTypeable a toSignature :: DBusTypeable a => a -> Type toDBusValue :: DBusTypeable a => a -> DBusValue fromDBusValue :: DBusTypeable a => DBusValue -> Maybe a module Network.DBus -- | Establish a new connection to dbus, using the two functions to first -- establish a new context, and second to authenticate to the bus. this -- will automatically create a mainloop thread. establish :: IO DBusContext -> (DBusContext -> IO ()) -> IO DBusConnection establishWithCatchall :: () => (DBusMessage -> IO ()) -> IO DBusContext -> (DBusContext -> IO a) -> IO DBusConnection -- | Close dbus socket and stop mainloop thread. disconnect :: DBusConnection -> IO () -- | opaque type representing a connection to DBus and a receiving -- dispatcher thread. maintain table to route message between handlers. data DBusConnection class DBusMessageable a toDBusMessage :: DBusMessageable a => a -> DBusMessage fromDBusMessage :: DBusMessageable a => DBusMessage -> Maybe a data DBusCall DBusCall :: ObjectPath -> Member -> Maybe Interface -> Body -> DBusCall [callPath] :: DBusCall -> ObjectPath [callMember] :: DBusCall -> Member [callInterface] :: DBusCall -> Maybe Interface [callBody] :: DBusCall -> Body data DBusReturn DBusReturn :: Serial -> Body -> DBusReturn [returnReplySerial] :: DBusReturn -> Serial [returnBody] :: DBusReturn -> Body data DBusError DBusError :: Serial -> ErrorName -> Body -> DBusError [errorReplySerial] :: DBusError -> Serial [errorName] :: DBusError -> ErrorName [errorBody] :: DBusError -> Body data DBusSignal DBusSignal :: ObjectPath -> Member -> Interface -> Body -> DBusSignal [signalPath] :: DBusSignal -> ObjectPath [signalMember] :: DBusSignal -> Member [signalInterface] :: DBusSignal -> Interface [signalBody] :: DBusSignal -> Body -- | DBus Types data DBusValue DBusByte :: Word8 -> DBusValue DBusBoolean :: Bool -> DBusValue DBusInt16 :: Int16 -> DBusValue DBusUInt16 :: Word16 -> DBusValue DBusInt32 :: Int32 -> DBusValue DBusUInt32 :: Word32 -> DBusValue DBusInt64 :: Int64 -> DBusValue DBusUInt64 :: Word64 -> DBusValue DBusDouble :: Double -> DBusValue DBusString :: PackedString -> DBusValue DBusObjectPath :: ObjectPath -> DBusValue DBusSignature :: Signature -> DBusValue DBusByteArray :: ByteString -> DBusValue DBusArray :: Type -> [DBusValue] -> DBusValue DBusStruct :: Signature -> [DBusValue] -> DBusValue DBusDict :: DBusValue -> DBusValue -> DBusValue DBusVariant :: DBusValue -> DBusValue DBusUnixFD :: Word32 -> DBusValue class DBusTypeable a toSignature :: DBusTypeable a => a -> Type toDBusValue :: DBusTypeable a => a -> DBusValue fromDBusValue :: DBusTypeable a => DBusValue -> Maybe a newtype ObjectPath ObjectPath :: String -> ObjectPath [unObjectPath] :: ObjectPath -> String newtype PackedString PackedString :: ByteString -> PackedString [ustringToBS] :: PackedString -> ByteString packedStringToString :: PackedString -> String -- | One possible signature element data Type SigByte :: Type SigBool :: Type SigInt16 :: Type SigUInt16 :: Type SigInt32 :: Type SigUInt32 :: Type SigInt64 :: Type SigUInt64 :: Type SigDouble :: Type SigString :: Type SigObjectPath :: Type SigSignature :: Type SigArray :: Type -> Type SigStruct :: [Type] -> Type SigVariant :: Type SigDict :: Type -> Type -> Type SigUnixFD :: Type -- | A list of signature element type Signature = [Type] -- | Deprecated: use Type instead type SignatureElem = Type data DBusMatchRules DBusMatchRules :: Maybe MessageType -> Maybe BusName -> Maybe Interface -> Maybe Member -> Maybe ObjectPath -> Maybe BusName -> DBusMatchRules [matchType] :: DBusMatchRules -> Maybe MessageType [matchSender] :: DBusMatchRules -> Maybe BusName [matchInterface] :: DBusMatchRules -> Maybe Interface [matchMember] :: DBusMatchRules -> Maybe Member [matchPath] :: DBusMatchRules -> Maybe ObjectPath [matchDestination] :: DBusMatchRules -> Maybe BusName defaultDBusMatchRules :: DBusMatchRules -- | dbus message types data MessageType TypeInvalid :: MessageType TypeMethodCall :: MessageType TypeMethodReturn :: MessageType TypeError :: MessageType TypeSignal :: MessageType newtype BusName BusName :: String -> BusName [unBusName] :: BusName -> String newtype ErrorName ErrorName :: String -> ErrorName [unErrorName] :: ErrorName -> String newtype Member Member :: String -> Member [unMember] :: Member -> String newtype Interface Interface :: String -> Interface [unInterface] :: Interface -> String -- | Add a match rules which will cause to receive message that aren't -- directed to this connection but match this rule. addMatch :: DBusConnection -> DBusMatchRules -> IO () -- | run a main DBus loop which will create a new dispatcher handshake on -- the bus and wait for message to dispatch runMainLoop :: DBusContext -> IO DBusConnection -- | similar to runMainLoop but also give the ability to specify a -- catch-all-message callback for any message that are not handled by -- specific function. runMainLoopCatchall :: (DBusMessage -> IO ()) -> DBusContext -> IO DBusConnection -- | call a method on the DBus, and wait synchronously for the return -- value. call :: DBusConnection -> BusName -> DBusCall -> IO DBusReturn -- | Send an arbitrary DBusMessageable message on the bus, using a new -- serial value. the serial value allocated is returned to the caller. -- -- PS: completely misnamed. reply :: DBusMessageable a => DBusConnection -> a -> IO Serial calltableFromList :: [(Member, Interface, a)] -> DispatchTable a -- | Deprecated: use registerCall registerPath :: DBusConnection -> ObjectPath -> DispatchTable Callback -> IO () -- | Deprecated: use unregisterCall unregisterPath :: DBusConnection -> ObjectPath -> IO () -- | Register a method handler table for a specific object path registerCall :: DBusConnection -> ObjectPath -> DispatchTable Callback -> IO () -- | Unregister all method handlers for a specific object path unregisterCall :: DBusConnection -> ObjectPath -> IO () -- | Register a signal handler table for a specific object path registerSignal :: DBusConnection -> ObjectPath -> DispatchTable Signalback -> IO () -- | Unregister all signals handler for a specific object path unregisterSignal :: DBusConnection -> ObjectPath -> IO () type Signalback = BusName -> Signature -> Body -> IO () type Callback = Serial -> Signature -> Body -> IO () type DispatchTable a = Map Member [(Interface, a)] -- | create a new DBus context on system bus busGetSystem :: IO DBusContext -- | create a new DBus context on session bus busGetSession :: IO DBusContext -- | authenticate to DBus using a raw bytestring. authenticate :: DBusContext -> ByteString -> IO () -- | authenticate to DBus using a UID. authenticateUID :: DBusContext -> Int -> IO () -- | use the real user UID to authenticate to DBus. authenticateWithRealUID :: DBusContext -> IO ()