File: Generation.hs

package info (click to toggle)
haskell-dbus 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 524 kB
  • sloc: haskell: 7,623; xml: 90; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,369 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{-# LANGUAGE OverloadedStrings #-}

module DBusTests.Generation where

import           DBus.Client
import qualified DBus.Internal.Types as T
import qualified DBus.Introspection.Types as I
import           Data.Int
import           Data.Map as M

sampleMethod1 :: String -> Int32 -> IO (M.Map String Int32)
sampleMethod1 a b = return $ M.insert a b M.empty

serviceArg :: I.SignalArg
serviceArg = I.SignalArg { I.signalArgName = "service"
                         , I.signalArgType = T.TypeString
                         }

testSignals :: [I.Signal]
testSignals = [ I.Signal { I.signalName = "StatusNotifierItemRegistered"
                         , I.signalArgs = [serviceArg]
                         }
              ]

testInterface :: Interface
testInterface =
  defaultInterface { interfaceMethods =
                       [autoMethod "SampleMethod1" sampleMethod1]
                   , interfaceProperties =
                     [autoProperty "SampleWriteProperty"
                                     (Just $ return (1 :: Int32))
                                     (Just $ const $ return ())
                     ]
                   , interfaceName = "org.TestInterface"
                   , interfaceSignals = testSignals
                   }

testIntrospectionInterface :: I.Interface
testIntrospectionInterface = buildIntrospectionInterface testInterface