10 class IrmpData(Structure
):
11 _fields_
= [ ("protocol" , c_uint32
),
12 ("protocolName" , c_char_p
),
13 ("address" , c_uint32
),
14 ("command" , c_uint32
),
15 ("flags" , c_uint32
),
16 ("startSample" , c_uint32
),
17 ("endSample" , c_uint32
),
22 # get the right filename
24 if platform
.uname()[0] == "Linux":
27 self
.__irmpDll
= cdll
.LoadLibrary("irmp.dll")
28 self
.__irmpDll
.IRMP_GetSampleRate
.restype
= c_int32
29 self
.__irmpDll
.IRMP_GetSampleRate
.argtypes
= []
32 self
.__irmpDll
.IRMP_GetProtocolName
.restype
= c_char_p
33 self
.__irmpDll
.IRMP_GetProtocolName
.argtypes
= [c_uint32
]
35 self
.__irmpDll
.IRMP_Reset
.restype
= None
36 self
.__irmpDll
.IRMP_Reset
.argtypes
= []
38 self
.__irmpDll
.IRMP_AddSample
.restype
= c_uint32
39 self
.__irmpDll
.IRMP_AddSample
.argtypes
= [c_uint8
]
41 self
.__irmpDll
.IRMP_GetData
.restype
= c_uint32
42 self
.__irmpDll
.IRMP_GetData
.argtypes
= [POINTER(IrmpWrap
.IrmpData
)]
44 self
.__irmpDll
.IRMP_Detect
.restype
= IrmpWrap
.IrmpData
45 self
.__irmpDll
.IRMP_Detect
.argtypes
= [ c_char_p
, c_uint32
]
47 self
.__data
= IrmpWrap
.IrmpData()
48 self
.__startSample
= c_uint32(0)
49 self
.__endSample
= c_uint32(0)
53 def GetProtocollName(self
, pn
):
54 return self
.__irmpDll
.IRMP_GetProtocollName(pn
)
56 def GetSampleRate(self
):
57 return self
.__irmpDll
.IRMP_GetSampleRate()
60 self
.__irmpDll
.IRMP_Reset()
62 def AddSample(self
, level
):
64 if self
.__irmpDll
.IRMP_AddSample(c_uint8( 1 if (level
!=0) else 0)):
65 self
.__irmpDll
.IRMP_GetData( byref(self
.__data
))
72 'protocol' : self
.__data
.protocol
,
73 'protocolName' : self
.__data
.protocolName
.decode('UTF-8'),
74 'address' : self
.__data
.address
,
75 'command' : self
.__data
.command
,
76 'repeat' : (self
.__data
.flags
!= 0)
78 'start' : self
.__data
.startSample
,
79 'end' : self
.__data
.endSample