pyrokid_cxr_clientm
com.rokid.cxr.client-m library for Python
A python port of the com.rokid.cxr.client-m Java library.
The idea is to allow you to use the CXR-M SDK on any device with bluetooth.
-
class pyrokid_cxr_clientm.CXRSocketProtocol[source]
Bases: object
com.rokid.cxr.client.CXRSocketProtocol Java class in Python
-
class Callback[source]
Bases: ABC
com.rokid.cxr.client.CXRSocketProtocol.Callback Interface - Please extend this class and implement the methods!
-
abstractmethod onARTCFrame(data: bytes) → None[source]
-
abstractmethod onAudioStream(i: int, data: bytes, offset: int, size: int) → None[source]
-
abstractmethod onAudioStreamFinish(codec: int) → None[source]
-
abstractmethod onDisconnect() → None[source]
-
abstractmethod onNotify(cmd: str, args: Caps) → None[source]
-
abstractmethod onReceived(cmd: str, args: Caps, stream: bytes) → None[source]
-
abstractmethod onResponse(reqId: int, args: Caps) → None[source]
-
abstractmethod onStartAudioStream(i: int, codec: int, cmd: str, args: Caps) → None[source]
-
a: str
mTag
-
b = None
-
c = None
-
d = None
-
e: Callable = None
-
f: int = 0
-
g: bool = False
-
h: bool = False
-
i: Callback = None
mCallback
-
j: int
size?
-
version() → int[source]
-
class pyrokid_cxr_clientm.Caps(values: list[Value] = None)[source]
Bases: object
Main Caps container class for serialization/deserialization
- Parameters:
values (Optional[list[Caps.Value]]) – Optional values list, in case you already have a list of Caps.Value’s.
Else its recommended to use Caps.fromBytes()
-
CAPS_VERSION = 5
Current Caps version.
-
exception CapsError[source]
Bases: Exception
Base exception for Caps operations
-
exception IncorrectTypeException[source]
Bases: RuntimeError
Exception that throws when Type of a Caps.Value is not what you were expecting
-
class Value(vType: chr = None, value: Any = None)[source]
Bases: object
Represents a single value in Caps format
-
TYPE_BINARY = 66
-
TYPE_DOUBLE = 100
-
TYPE_FLOAT = 102
-
TYPE_INT32 = 105
-
TYPE_INT64 = 108
-
TYPE_OBJECT = 79
-
TYPE_STRING = 83
-
TYPE_UINT32 = 117
-
TYPE_UINT64 = 107
-
TYPE_VOID = 86
-
getBinary() → bytes[source]
Validate if value is bytes/BINARY and return it
-
getDouble() → float[source]
Validate if value is float/DOUBLE and return it
-
getFloat() → float[source]
Validate if value is float/FLOAT and return it
-
getInt() → int[source]
Validate if value is int/IN32/UINT32 and return it
-
getLong() → int[source]
Validate if value is long/INT64/UINT64 and return it
-
getObject() → Caps[source]
Validate if value is Caps/OBJECT and return it
-
getString() → str[source]
Validate if value is str/STRING and return it
-
getValueNoType() → Any[source]
-
type() → chr[source]
Determine the type code for this value
-
at(index: int) → Value[source]
Get member value by index
-
clear() → None[source]
Clear all members
-
dump() → str[source]
-
static fromBytes(data: bytes) → tuple[Caps, bytes][source]
Parse a new Caps object from bytes
-
parse(data: bytes) → tuple[Caps, bytes][source]
Parse a bytes to the current Caps object
-
serialize() → bytes[source]
Serialize the Caps object to bytes
Format: [4 bytes size][1 byte version][member descriptors][member data]
-
size() → int[source]
Return the number of members
-
toString() → str[source]
-
write(value: Any = None) → Caps[source]
Add a value to the Caps object
-
writeBinary(value: bytes) → Caps[source]
Write binary data
-
writeBoolean(value: bool) → Caps[source]
Write a void value
-
writeDouble(value: float) → Caps[source]
Write a double value
-
writeFloat(value: float) → Caps[source]
Write a float value
-
writeInt32(value: int) → Caps[source]
Write an integer value
-
writeInt64(value: int) → Caps[source]
Write a long integer value
-
writeObject(value: Caps) → Caps[source]
Write a nested Caps object
-
writeString(value: str) → Caps[source]
Write a string value
-
writeUInt32(value: int) → Caps[source]
Write an unsigned integer value
-
writeUInt64(value: int) → Caps[source]
Write an unsigned long value
-
writeVoid() → Caps[source]
Write a void value
-
class pyrokid_cxr_clientm.PacketTypeIds(*values)[source]
Bases: IntEnum
Packet Type IDs used in CXRSocketProtocol Requests and Responses
-
ARTC_DATA = 8210
-
ARTC_END = 8211
-
ARTC_START = 8209
-
AUDIO_DATA = 12290
-
AUDIO_END = 12291
-
AUDIO_START = 12289
-
AUTH_REQUEST = 4100
-
AUTH_RESPONSE = 4101
-
NOTIFY = 4099
-
REQUEST = 4097
-
RESPONSE = 4098
-
ROKID_ACCOUNT_REQUEST = 4102
-
TRANSFER_DATA = 8194
-
TRANSFER_END = 8195
-
TRANSFER_START = 8193