Skip to content

Commit

Permalink
#1 Moved DeviceIdentification1 to own file
Browse files Browse the repository at this point in the history
  • Loading branch information
arnegue committed Mar 17, 2024
1 parent 4751f07 commit 03daad8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
1 change: 1 addition & 0 deletions seatalk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@
from seatalk.s82_target_waypoint_name import TargetWaypointName
from seatalk.s86_key_stroke2 import KeyStroke2
from seatalk.s87_set_response_level import SetResponseLevel
from seatalk.s90_device_identification1 import DeviceIdentification1
28 changes: 28 additions & 0 deletions seatalk/s90_device_identification1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import enum

from common.helper import TwoWayDict
from seatalk.seatalk_datagram import _TwoWayDictDatagram


class DeviceIdentification1(_TwoWayDictDatagram):
"""
90 00 XX Device Identification
XX=02 sent by ST600R ~every 2 secs
XX=05 sent by type 150, 150G and 400G course computer
XX=A3 sent by NMEA <-> SeaTalk bridge ~every 10 secs
"""
seatalk_id = 0x90
data_length = 0

class DeviceID(enum.IntEnum):
ST600R = enum.auto()
Type_150_150G_400G = enum.auto()
NMEASeatalkBridge = enum.auto()

def __init__(self, device_id: DeviceID=None):
device_id_map = TwoWayDict({
bytes([0x02]): self.DeviceID.ST600R,
bytes([0x05]): self.DeviceID.Type_150_150G_400G,
bytes([0xA3]): self.DeviceID.NMEASeatalkBridge
})
_TwoWayDictDatagram.__init__(self, map=device_id_map, set_key=device_id)
24 changes: 0 additions & 24 deletions seatalk/seatalk_datagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,30 +334,6 @@ def get_seatalk_datagram(self):

# Description of Thomas Knauf for 0x83 is weird: "83 07 XX 00 00 00 00 00 80 00 00": That's one byte too much. But which one? 0x80?

class DeviceIdentification1(_TwoWayDictDatagram):
"""
90 00 XX Device Identification
XX=02 sent by ST600R ~every 2 secs
XX=05 sent by type 150, 150G and 400G course computer
XX=A3 sent by NMEA <-> SeaTalk bridge ~every 10 secs
"""
seatalk_id = 0x90
data_length = 0

class DeviceID(enum.IntEnum):
ST600R = enum.auto()
Type_150_150G_400G = enum.auto()
NMEASeatalkBridge = enum.auto()

def __init__(self, device_id: DeviceID=None):
device_id_map = TwoWayDict({
bytes([0x02]): self.DeviceID.ST600R,
bytes([0x05]): self.DeviceID.Type_150_150G_400G,
bytes([0xA3]): self.DeviceID.NMEASeatalkBridge
})
_TwoWayDictDatagram.__init__(self, map=device_id_map, set_key=device_id)


class SetRudderGain(SeatalkDatagram):
"""
91 00 0X Set Rudder gain to X
Expand Down

0 comments on commit 03daad8

Please sign in to comment.