CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
psyclone_client.datamessage Namespace Reference

Classes

class  Layout
class  PsyTime
class  _Levels
class  PsyType
class  PsyContext
class  Time
class  Raw
class  DataMessage
class  _Packed

Variables

tuple M64 = (1 << 64) - 1
tuple M32 = (1 << 32) - 1
list _ATTRS

Detailed Description

CMSDK DataMessage in pure Python: byte-exact with the C++ library (and the Kotlin codec).

Both wire forms are supported: the regular block (C++ ``DataMessage::data``, 200-byte header +
entries) and the packed form (C++ ``DataMessage::toPacked()``), which Psyclone services accept and
answer in. The layout must stay in step with CMSDK ``include/DataMessage.h``; the tests check it
against the golden messages the C++ library writes (``CMSDK/kotlin/fixtures``).

    from psyclone_client import DataMessage
    m = DataMessage().set_string("PsyPost", "AudioFrame").set_data("pcm", pcm)
    m["Gain"] = 0.7                     # str -> text, int -> int64, float -> double, bytes -> data
    wire = m.to_bytes()                 # or m.to_packed_bytes()
    back = DataMessage.from_bytes(wire) # either form

Variable Documentation

◆ _ATTRS

list psyclone_client.datamessage._ATTRS
protected
Initial value:
1= [("cenc", "cenc"), ("memid", "memid"), ("time", "time"), ("sendtime", "send_time"),
2 ("recvtime", "recv_time"), ("origin", "origin"), ("destination", "destination"), ("ttl", "ttl"),
3 ("priority", "priority"), ("policy", "policy"), ("from", "from_id"), ("to", "to_id"),
4 ("tag", "tag"), ("status", "status"), ("reference", "reference"), ("serial", "serial"),
5 ("cyclecputime", "cycle_cpu_time"), ("cyclewalltime", "cycle_wall_time"),
6 ("chaincputime", "chain_cpu_time"), ("chainwalltime", "chain_wall_time"),
7 ("chaincount", "chain_count"), ("systemid", "system_id")]

Definition at line 56 of file datamessage.py.

◆ M32

tuple psyclone_client.datamessage.M32 = (1 << 32) - 1

Definition at line 20 of file datamessage.py.

◆ M64

tuple psyclone_client.datamessage.M64 = (1 << 64) - 1

Definition at line 19 of file datamessage.py.