9
9
10
10
__author__ = 'Jared'
11
11
12
- from value import Value
13
- from struct import Struct
14
- from matenet import Mate
12
+ from pymate . value import Value
13
+ from pymate . cstruct import Struct
14
+ from pymate . matenet import Mate
15
15
16
16
class DCStatusPacket (object ):
17
17
fmt = Struct ('>28B' )
@@ -60,27 +60,27 @@ def __str__(self):
60
60
"""
61
61
return fmt .format (** self .__dict__ )
62
62
63
- class MateDCDevice (Mate ):
63
+ class MateDCDevice (MateDevice ):
64
64
"""
65
65
Communicate with a FLEXnet DC unit attached to the MateNET bus
66
66
"""
67
67
def scan (self ):
68
68
"""
69
69
Query the attached device to make sure we're communicating with an FLEXnet DC unit
70
70
"""
71
- devid = super (MateFlexNetDC , self ).scan (port )
71
+ devid = super (MateFlexNetDC , self ).scan ()
72
72
if devid == None :
73
73
raise RuntimeError ("No response from the FLEXnet DC unit" )
74
- if devid != Mate .DEVICE_FLEXNETDC :
74
+ if devid != MateDevice .DEVICE_FLEXNETDC :
75
75
raise RuntimeError ("Attached device is not a FLEXnet DC unit! (DeviceID: %s)" % devid )
76
76
77
77
def get_status (self ):
78
78
"""
79
79
Request a status packet from the FLEXnet DC
80
80
:return: A DCStatusPacket
81
81
"""
82
- resp1 = self .send (Mate .TYPE_STATUS , addr = 1 )
83
- resp2 = self .send (Mate .TYPE_STATUS , addr = 2 ) # TODO: This also returns data!
82
+ resp1 = self .send (MateDevice .TYPE_STATUS , addr = 1 )
83
+ resp2 = self .send (MateDevice .TYPE_STATUS , addr = 2 ) # TODO: This also returns data!
84
84
if resp1 and resp2 :
85
85
print 'RAW[1]:' , (' ' .join ("{:02x}" .format (ord (c )) for c in resp1 [1 :]))
86
86
print 'RAW[2]:' , (' ' .join ("{:02x}" .format (ord (c )) for c in resp2 [1 :]))
@@ -94,7 +94,7 @@ def get_logpage(self, day):
94
94
"""
95
95
# TODO: This doesn't return anything. It must have a different command.
96
96
# The UserGuide does mention having access to log pages
97
- #resp = self.send(Mate .TYPE_LOG, addr=0, param=-day)
97
+ #resp = self.send(MateDevice .TYPE_LOG, addr=0, param=-day)
98
98
#if resp:
99
99
# print 'RAW:', (' '.join("{:02x}".format(ord(c)) for c in resp[1:]))
100
100
# #return DCLogPagePacket.from_buffer(resp)
0 commit comments