Package libprs500 :: Module prstypes :: Class Command
[hide private]
[frames] | no frames]

Class Command

source code


Defines the structure of command packets sent to the device.

Instance Methods [hide private]
  __init__(self, packet)

Inherited from TransferBuffer: __add__, __getslice__, __str__, pack, unpack

Inherited from TransferBuffer (private): _normalize

Inherited from list: __contains__, __delitem__, __delslice__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __iadd__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __repr__, __reversed__, __rmul__, __setitem__, __setslice__, append, count, extend, index, insert, pop, remove, reverse, sort

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__


Class Methods [hide private]

Inherited from TransferBuffer: phex


Properties [hide private]
  number
Command number.
  type
Command type.
  length
Length in bytes of the data part of the query.
  data
The data part of this command.

Inherited from object: __class__


Method Details [hide private]

__init__(self, packet)
(Constructor)

source code 
Parameters:
  • packet - len(packet) > 15 or packet > 15
Overrides: TransferBuffer.__init__

Property Details [hide private]

number

Command number. unsigned int stored in 4 bytes at byte 0.

Observed command numbers are:
  1. 0x00 Test bulk read
  2. 0x01 End session
  3. 0x0101 Ask for device information
  4. 0x1000 Acknowledge
  5. 0x107 Purpose unknown, occurs in the beginning of sessions duing command testing. Best guess is some sort of OK packet
  6. 0x106 Purpose unknown, occurs in the beginning of sessions duing command testing. Best guess is some sort of OK packet
  7. 0x18 Ask for information about a file
  8. 0x33 Open directory for reading
  9. 0x34 Close directory
  10. 0x35 Ask for next item in the directory
  11. 0x10 File open command
  12. 0x11 File close command
  13. 0x16 File read command
Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, val)
Delete Method:
None                                                                  

type

Command type. unsigned long long stored in 8 bytes at byte 4. Known types 0x00, 0x01. Not sure what the type means.
Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, val)
Delete Method:
None                                                                  

length

Length in bytes of the data part of the query. unsigned int stored in 4 bytes at byte 12.
Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, val)
Delete Method:
None                                                                  

data

The data part of this command. Returned/set as/by a TransferBuffer. Stored at byte 16.

Setting it by default changes self.length to the length of the new buffer. You may have to reset it to the significant part of the buffer. You would normally use the command property of ShortCommand or LongCommand instead.
Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, buffer)
Delete Method:
None