PyVLCB 0.2.7__tar.gz → 0.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyVLCB
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: A library for CBUS / VLCB communication
5
5
  Author-email: "Stewart Watkiss (penguintutor)" <5587863+penguintutor@users.noreply.github.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "PyVLCB"
7
- version = "0.2.7"
7
+ version = "0.2.8"
8
8
  description = "A library for CBUS / VLCB communication"
9
9
  readme = {file="README.md", content-type = "text/markdown"}
10
10
  requires-python = ">=3.6"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyVLCB
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: A library for CBUS / VLCB communication
5
5
  Author-email: "Stewart Watkiss (penguintutor)" <5587863+penguintutor@users.noreply.github.com>
6
6
  License: MIT License
@@ -13,4 +13,5 @@ src/pyvlcb/utils.py
13
13
  src/pyvlcb/vlcbformat.py
14
14
  src/pyvlcb/tests/run_tests.py
15
15
  src/pyvlcb/tests/test_canusb4.py
16
+ src/pyvlcb/tests/test_opcodes.py
16
17
  src/pyvlcb/tests/test_vlcb.py
@@ -0,0 +1,23 @@
1
+ import unittest
2
+
3
+ import os
4
+
5
+ from pyvlcb import VLCB, VLCBFormat, VLCBOpcode
6
+
7
+ ## Test for VLCB library
8
+ # Test that the OpCodes are formatted correctly (particular the format field)
9
+ class TestOpCodes(unittest.TestCase):
10
+ # Check each of the format entries exist in the field_formats list
11
+ def test_opcode_format(self):
12
+ for thisopcode in VLCBOpcode.opcodes.keys():
13
+
14
+ if VLCBOpcode.opcodes[thisopcode]['format'] == "":
15
+ continue
16
+ field_codes = VLCBOpcode.opcodes[thisopcode]['format'].split(',')
17
+ for this_code in field_codes:
18
+ #print (f"Checking Opcode {thisopcode} format :{this_code}:")
19
+ self.assertTrue(this_code in VLCBOpcode.field_formats.keys())
20
+
21
+
22
+ if __name__ == '__main__':
23
+ unittest.main()
@@ -92,6 +92,7 @@ class TestVLCB(unittest.TestCase):
92
92
  self.assertEqual(f_to_bytes (2, functions), ("01", "19"))
93
93
  self.assertEqual(f_to_bytes (7, functions), ("02", "06"))
94
94
  self.assertEqual(f_to_bytes (24, functions), ("05", "00"))
95
+
95
96
 
96
97
 
97
98
  if __name__ == "__main__":
@@ -336,7 +336,7 @@ class VLCBOpcode:
336
336
  'F9': {'opc': 'ASOF3', 'title': 'Accessory Short OFF', 'format': 'NN,DNHigh_DNLow,Byte1,Byte2,Byte3', 'minpri': 3, 'comment': 'Indicates an OFF event using the short event number of 2 LS bytes with three added data bytes.'},
337
337
  'FA': {'opc': 'DDES', 'title': 'Device data event (short mode)', 'format': 'DNHigh_DNLow,Byte1,Byte2,Byte3,Byte4,Byte5', 'minpri': 3, 'comment': 'Function is the same as F6 but uses device addressing so can relate data to a device attached to a node. e.g. one of several RFID readers attached to a single node.'},
338
338
  'FB': {'opc': 'DDRS', 'title': 'Device data response (short mode)', 'format': 'DNHigh_DNLow,Byte1,Byte2,Byte3,Byte4,Byte5', 'minpri': 3, 'comment': 'The response to a request for data from a device. (0x5B)'},
339
- 'FC': {'opc': 'DDWS', 'title': 'Write data', 'format': 'DNHigh_DNLow,byte1,byte2,byte3,byte4,byte5', 'minpri': 0, 'comment': 'Used to write data to a device such as an RFID tag. For RC522 byte1 should be 0.'},
339
+ 'FC': {'opc': 'DDWS', 'title': 'Write data', 'format': 'DNHigh_DNLow,Byte1,Byte2,Byte3,Byte4,Byte5', 'minpri': 0, 'comment': 'Used to write data to a device such as an RFID tag. For RC522 byte1 should be 0.'},
340
340
  'FD': {'opc': 'ARSON3', 'title': 'Accessory Short Response Event', 'format': 'NN,DNHigh_DNLow,Byte1,Byte2,Byte3', 'minpri': 3, 'comment': "Indicates an ON response event with with three added data bytes. A response event is a reply to a status request (ASRQ) without producing an ON or OFF event."},
341
341
  'FE': {'opc': 'ARSOF3', 'title': 'Accessory Short Response Event', 'format': 'NN,DNHigh_DNLow,Byte1,Byte2,Byte3', 'minpri': 3, 'comment': "Indicates an OFF response event with with three added data bytes. A response event is a reply to a status request (ASRQ) without producing an ON or OFF event."},
342
342
  'FF': {'opc': 'EXTC6', 'title': 'Extended op-code with 6 data bytes', 'format': 'ExtOpc,Byte1,Byte2,Byte3,Byte4,Byte5,Byte6', 'minpri': 3, 'comment': 'Used if the basic set of 32 OPCs is not enough. Allows an additional 256 OPCs'}
@@ -353,8 +353,9 @@ class VLCBOpcode:
353
353
  "Consist": [2, "num"], # Consist ID
354
354
  "Index": [2, "num"], # Index of loco in consist
355
355
  "Status": [2, "hex"],
356
- "NN": [4, "num"], # Node number
357
- "AllocCode": [2, "num"], # Specific allocation code
356
+ "NN": [4, "num"], # Node number
357
+ "NNIndex": [2, "num"], # Index for the node variable value
358
+ "AllocCode": [2, "num"], # Specific allocation code
358
359
  "SpeedDir": [2, "hex"],
359
360
  "SpeedFlag": [2, "hex"], # Speed flags DDD-DDDDD
360
361
  "Fnum": [2, "num"], # Function number
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes