Skip to content

Commit 7de77da

Browse files
committed
Update flexnet files to match new API
1 parent f9e4f54 commit 7de77da

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

pymate/matenet/flexnetdc.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
__author__ = 'Jared'
1111

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
1515

1616
class DCStatusPacket(object):
1717
fmt = Struct('>28B')
@@ -60,27 +60,27 @@ def __str__(self):
6060
"""
6161
return fmt.format(**self.__dict__)
6262

63-
class MateDCDevice(Mate):
63+
class MateDCDevice(MateDevice):
6464
"""
6565
Communicate with a FLEXnet DC unit attached to the MateNET bus
6666
"""
6767
def scan(self):
6868
"""
6969
Query the attached device to make sure we're communicating with an FLEXnet DC unit
7070
"""
71-
devid = super(MateFlexNetDC, self).scan(port)
71+
devid = super(MateFlexNetDC, self).scan()
7272
if devid == None:
7373
raise RuntimeError("No response from the FLEXnet DC unit")
74-
if devid != Mate.DEVICE_FLEXNETDC:
74+
if devid != MateDevice.DEVICE_FLEXNETDC:
7575
raise RuntimeError("Attached device is not a FLEXnet DC unit! (DeviceID: %s)" % devid)
7676

7777
def get_status(self):
7878
"""
7979
Request a status packet from the FLEXnet DC
8080
:return: A DCStatusPacket
8181
"""
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!
8484
if resp1 and resp2:
8585
print 'RAW[1]:', (' '.join("{:02x}".format(ord(c)) for c in resp1[1:]))
8686
print 'RAW[2]:', (' '.join("{:02x}".format(ord(c)) for c in resp2[1:]))
@@ -94,7 +94,7 @@ def get_logpage(self, day):
9494
"""
9595
# TODO: This doesn't return anything. It must have a different command.
9696
# 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)
9898
#if resp:
9999
# print 'RAW:', (' '.join("{:02x}".format(ord(c)) for c in resp[1:]))
100100
# #return DCLogPagePacket.from_buffer(resp)

testflexnet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from matenet import MateNET, MateDCDevice
1+
from pymate.matenet import MateNET, MateDCDevice
22
from time import sleep
33

44
print "MATE emulator (FLEXnet DC)"

testfx.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from matenet import MateNET, MateFXDevice
1+
from pymate.matenet import MateNET, MateFXDevice
22
from time import sleep
33

44
print "MATE emulator (FX)"

0 commit comments

Comments
 (0)