API

coapy

copyright:Copyright 2013, Peter A. Bigot
license:Apache-2.0
coapy.COAPS_PORT = 0

The IANA-assigned default port number for secured CoAP (the “coaps” URI scheme).

coapy.COAP_PORT = 5683

The IANA-assigned default port number for unsecured CoAP (the “coap” URI scheme).

class coapy.ManagedClock[source]

Bases: coapy._Clock

A clock that increments under program control.

An instance of this class may be placed in coapy.clock to ensure deterministic behavior for simulation and automated testing. The value of the clock is initially zero; it is changed only through the adjust() method.

adjust(adj)[source]

Add adj to the clock value.

class coapy.RealTimeClock[source]

Bases: coapy._Clock

A clock that increments in lock-step with real-time.

This uses time.time() to obtain the current time. epoch is a record of the time at which the clock was created.

class coapy._Clock[source]

Bases: object

Base class for CoAPy clock abstraction.

An instance of (a subclass of) this class is made available globally at coapy.clock.

The current clock value is obtained by invoking the instance as a callable object.

epoch[source]

The value of this clock at a point corresponding to “system start”.

Set implicitly when the clock instance is created.

coapy.clock = <coapy.RealTimeClock object at 0x3bfca90>

The system clock.

This is an instance of _Clock that returns a non-decreasing ordinal when invoked (probably a float but possibly an int). The integer part increments in “seconds”. It is used for Max-Age, state related to congestion control and message retransmission, and other time-related phenomena.

Note

The default value is an instance of RealTimeClock, but this may be overridden with an instance of ManagedClock for the purposes of simulation or testing. Unless you’re doing this sort of thing, you should assume the clock increments in lock step with real-world time.

coapy.transmissionParameters = None

The default instance of TransmissionParameters for the system.

This is initialized when coapy.message is first loaded.

Table Of Contents

Previous topic

Release History

Next topic

coapy.message

This Page