Pycolo

pycolo Package

CoAP Protocol constants

DEFAULT_PORT:default CoAP port as defined in draft-ietf-core-coap-05, section 7.1: MUST be supported by a server for resource discovery and SHOULD be supported for providing access to other resources.
URI_SCHEME_NAME:
 CoAP URI scheme name as defined in draft-ietf-core-coap-05, section 11.4.
MAX_RETRANSMIT:maximal number of retransmissions before the attempt to transmit a message is canceled
OBSERVING_REFRESH_INTERVAL:
 the number of notifications until a CON notification will be used
DEFAULT_BLOCK_SIZE:
 the default block size for block-wise transfers must be power of two between 16 and 1024 bytes.
MESSAGE_CACHE_SIZE:
 capacity (in messages) for caches. Used for duplicate detection and retransmissions.
RX_BUFFER_SIZE:buffer size for incoming datagrams, in bytes
DEFAULT_OVERALL_TIMEOUT:
 time (in milliseconds) for transaction to complete. Used to avoid infinite waits for replies to non-confirmables and separate responses
RESPONSE_TIMEOUT & RESPONSE_RANDOM_FACTOR:
 constants to calculate initial timeout for confirmable messages, used by the exponential backoff mechanism
TODO:Find a better value for RX_BUFFER_SIZE

codes Module

Registry of all constant status code

codes:describes the CoAP Code Registry
mediaCodes:describes the CoAP Media Type Registry
options:describes the CoAP Option Number Registry
pycolo.codes.isElective(optionNumber)[source]

Checks whether a code indicates an elective option number.

Parameters:optionNumber – Code to test
Returns:True if option number is a valid elective number, False otherwise.
pycolo.codes.isRequest(code)[source]

Checks whether a code indicates a request.

Parameters:code – code the code to check
Returns:True if the code indicates a request
pycolo.codes.isResponse(code)[source]

Checks whether a code indicates a response number.

Parameters:code – Code to test
Returns:True if option number is a valid response number, False otherwise.
pycolo.codes.isValid(code)[source]

Checks whether a code indicates a valid.

Parameters:code – Code to test.
Returns:True if option number is valid, False otherwise.
pycolo.codes.opaque_256_many(min_size, max_size, default=None)[source]

TODO

Parameters:
  • min_size
  • max_size
  • default
Returns:

pycolo.codes.presence_once()[source]

TODO

Returns:
pycolo.codes.responseClass(code)[source]

Returns the response class of a code

Parameters:code – the code to check
Returns:The response class of the code
pycolo.codes.string_many(min_size, max_size, default=None)[source]

Repeatable string option.

Parameters:
  • min_size
  • max_size
  • default
Returns:

pycolo.codes.string_once(min_size, max_size, default=None)[source]

TODO

Parameters:
  • min_size
  • max_size
  • default
Returns:

pycolo.codes.uint_many(min_size, max_size, default=None)[source]

TODO

Parameters:
  • min_size
  • max_size
  • default
Returns:

pycolo.codes.uint_once(min_size, max_size, default=None)[source]

TODO

Parameters:
  • min_size
  • max_size
  • default
Returns:

endpoint Module

layers Module

message Module

observe Module

The TokenManager stores all tokens currently used in transfers. New transfers can acquire unique tokens from the manager.

pycolo.observe.addObserver(request, resource)[source]

get clients map for the given resource path :param request: :param resource:

pycolo.observe.isObserved(uri)[source]
pycolo.observe.notifyObservers(resource)[source]
pycolo.observe.prepareResponse(request)[source]

consecutive response require new MID that must be stored for RST matching :param request:

pycolo.observe.removeObserver(client, resource=None, mid=None)[source]

Remove a selected observer from observation structures. Remove an observer by MID from RST. :param mid: the MID from the RST :param resource: the resource to un-observe. :param client: the peer address as string.

pycolo.observe.updateLastMID(clientID, path, mid)[source]

request Module

resource Module

pycolo.structures

Pycolo resource.

class pycolo.resource.Resource(title, resourceIdentifier=None, interfaceDescription=None, link_format='', hidden=False, observable=False, parent=None, resourceType=None, contentType=None)[source]
Parameters:
  • title
  • resourceIdentifier
  • link_format
  • hidden
  • observable
Raise :
attributes = {'resourceType': 'rt', 'interfaceDescription': 'if', 'contentType': 'ct', 'sizeEstimate': 'sz', 'title': 'title'}
changed()[source]

Send a notification to all the subscribed resource. :return:

count(recursive=False)[source]

Counting sub resources. :param recursive: :raise:

getPath()[source]

Returns the full resource path.

subResources = {}

Serialize to a link format definitions as specified in draft-ietf-core-link-format-06 :param self:

token Module

The TokenManager stores all tokens currently used in transfers. New transfers can acquire unique tokens from the manager.

pycolo.token.acquireToken(preferEmptyToken=False)[source]

Returns an unique token.

Parameters:preferEmptyToken – If set to true, the caller will receive the empty token if it is available.

This is useful for reducing datagram sizes in transactions that are expected to complete in short time. On the other hand, empty tokens are not preferred in block - wise transfers, as the empty token is then not available for concurrent transactions.

pycolo.token.isAcquired(token)[source]

Checks if a token is acquired by this manager.

Parameters:token – The token to check
Returns:True iff the token is currently in use
pycolo.token.nextToken()[source]

Returns the next message ID to use out of the consecutive 16 - bit range.

Returns:the current message ID
pycolo.token.releaseToken(token)[source]

Releases an acquired token and makes it available for reuse.

Parameters:token – The token to release

Project Versions

Table Of Contents

Previous topic

API

Next topic

tests Package

This Page