Module prototypes :: Class USTRING
[hide private]
[frames] | no frames]

Class USTRING

source code

       object --+    
                |    
BaseProtogenClass --+
                    |
                   USTRING

A text string that supports configurable encodings

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
A string value can be specified to this constructor, or in the value keyword arg.
source code
 
_update(self, args, kwargs) source code
 
readfrombuffer(self, buf)
Get our value from the buffer
source code
 
writetobuffer(self, buf)
Scribble ourselves to the buf
source code
 
convert_for_write(self) source code
 
packetsize(self)
Returns size in bytes that we occupy
source code
 
getvalue(self)
Returns the string we are
source code

Inherited from BaseProtogenClass: autologread, autologwrite, iscontainer, packetspan, update

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 

A string value can be specified to this constructor, or in the value keyword arg.

Parameters:
  • constant - (Optional) A constant value. All reads must have this value
  • terminator - (Default=0) The string terminator (or None). If set there will always be a terminator when writing. The terminator is not returned when getting the value.
  • terminator_length - (Default=1) (min:1, max:4)The length of the string terminator. This keyword is not used if the terminator is None. Multi-byte terminators are treated as LSB when read from the phone.
  • pad - (Default=0) The padding byte if fixed length when writing, or stripped off when reading
  • sizeinbytes - (Optional) Set if fixed length. If not set, then the terminator will be used to find the end of strings on reading. If not set and the terminator is None, then reads will be entire rest of buffer.
  • maxsizeinbytes - (Optional) Max string length. Used together with terminator to limit the max length of the value.
  • default - (Optional) Our default value
  • raiseonunterminatedread - (Default True) raise NotTerminatedException if there is no terminator on the value being read in. Terminator must also be set.
  • raiseontruncate - (Default True) raise ValueLengthException if the supplied value is too large to fit within sizeinbytes.
  • value - (Optional) Value
  • pascal - (Default False) The string is preceded with one byte giving the length of the string (including terminator if there is one)
  • encoding - (Default 'ascii') The charset to use when reading/writing to a buffer
  • read_encoding - (Default keyword:encoding) The charset to use when reading from a buffer
  • write_encoding - (Default keyword:encoding) The charset to use when writing to a buffer
Overrides: object.__init__

_update(self, args, kwargs)

source code 
Overrides: BaseProtogenClass._update

readfrombuffer(self, buf)

source code 

Get our value from the buffer

Overrides: BaseProtogenClass.readfrombuffer
(inherited documentation)

writetobuffer(self, buf)

source code 

Scribble ourselves to the buf

Overrides: BaseProtogenClass.writetobuffer
(inherited documentation)

packetsize(self)

source code 

Returns size in bytes that we occupy

Overrides: BaseProtogenClass.packetsize
(inherited documentation)

getvalue(self)

source code 

Returns the string we are

Overrides: BaseProtogenClass.getvalue