Skip to content

Commit

Permalink
allow the property identifier in commands to be just an integer, it w…
Browse files Browse the repository at this point in the history
…as inconsistent in the samples
  • Loading branch information
JoelBender committed Nov 4, 2020
1 parent f834e53 commit 47714a2
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions samples/Discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ def do_rp(self, args):

devid = int(devid)
obj_id = ObjectIdentifier(obj_id).value
if prop_id.isdigit():
prop_id = int(prop_id)

datatype = get_datatype(obj_id[0], prop_id)
if not datatype:
Expand Down
2 changes: 2 additions & 0 deletions samples/HTTPServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ def do_read(self, args):
# implement a default property, the bain of committee meetings
if len(args) == 3:
prop_id = args[2]
if prop_id.isdigit():
prop_id = int(prop_id)
else:
prop_id = "presentValue"

Expand Down
2 changes: 2 additions & 0 deletions samples/ReadProperty.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def do_read(self, args):
try:
addr, obj_id, prop_id = args[:3]
obj_id = ObjectIdentifier(obj_id).value
if prop_id.isdigit():
prop_id = int(prop_id)

datatype = get_datatype(obj_id[0], prop_id)
if not datatype:
Expand Down
2 changes: 2 additions & 0 deletions samples/ReadProperty25.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def do_read(self, args):
try:
addr, obj_id, prop_id = args[:3]
obj_id = ObjectIdentifier(obj_id).value
if prop_id.isdigit():
prop_id = int(prop_id)

datatype = get_datatype(obj_id[0], prop_id)
if not datatype:
Expand Down
2 changes: 2 additions & 0 deletions samples/ReadPropertyAny.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def do_read(self, args):
try:
addr, obj_id, prop_id = args[:3]
obj_id = ObjectIdentifier(obj_id).value
if prop_id.isdigit():
prop_id = int(prop_id)

# build a request
request = ReadPropertyRequest(
Expand Down
2 changes: 2 additions & 0 deletions samples/ReadPropertyForeign.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def do_read(self, args):
try:
addr, obj_id, prop_id = args[:3]
obj_id = ObjectIdentifier(obj_id).value
if prop_id.isdigit():
prop_id = int(prop_id)

datatype = get_datatype(obj_id[0], prop_id)
if not datatype:
Expand Down
2 changes: 2 additions & 0 deletions samples/ReadPropertyJSON.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def do_read(self, args):
try:
addr, obj_id, prop_id = args[:3]
obj_id = ObjectIdentifier(obj_id).value
if prop_id.isdigit():
prop_id = int(prop_id)

datatype = get_datatype(obj_id[0], prop_id)
if not datatype:
Expand Down
2 changes: 2 additions & 0 deletions samples/ReadRange.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def do_readrange(self, args):
addr = Address(args.pop(0))
obj_id = ObjectIdentifier(args.pop(0)).value
prop_id = args.pop(0)
if prop_id.isdigit():
prop_id = int(prop_id)

datatype = get_datatype(obj_id[0], prop_id)
if not datatype:
Expand Down
2 changes: 2 additions & 0 deletions samples/ReadWriteProperty.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def do_read(self, args):
try:
addr, obj_id, prop_id = args[:3]
obj_id = ObjectIdentifier(obj_id).value
if prop_id.isdigit():
prop_id = int(prop_id)

datatype = get_datatype(obj_id[0], prop_id)
if not datatype:
Expand Down
2 changes: 1 addition & 1 deletion samples/VendorReadWriteProperty.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def do_read(self, args):
try:
addr, obj_id, prop_id = args[:3]
obj_id = ObjectIdentifier(obj_id).value

if prop_id.isdigit():
prop_id = int(prop_id)

if _debug: ReadWritePropertyConsoleCmd._debug(" - prop_id: %r", prop_id)

datatype = get_datatype(obj_id[0], prop_id, VendorAVObject.vendor_id)
Expand Down
2 changes: 2 additions & 0 deletions samples/WriteLightingCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def do_read(self, args):
try:
addr, obj_id, prop_id = args[:3]
obj_id = ObjectIdentifier(obj_id).value
if prop_id.isdigit():
prop_id = int(prop_id)

datatype = get_datatype(obj_id[0], prop_id)
if not datatype:
Expand Down
3 changes: 2 additions & 1 deletion samples/WriteSomething.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def do_write(self, args):
try:
addr, obj_id, prop_id = args[:3]
obj_id = ObjectIdentifier(obj_id).value
prop_id = int(prop_id)
if prop_id.isdigit():
prop_id = int(prop_id)

# build a request
request = WritePropertyRequest(
Expand Down

0 comments on commit 47714a2

Please sign in to comment.