Message Reference¶
The message encapsulating the concept of mind as a data and defines how the on going messages in the system look like.
We start by describing the general features of every class that is part of our message; and continuing by describing the classes.
Classes¶
All can be imported from brain-computer-interface.message
- class ColorImage(width, height, data)¶
Holds a color image information from the user’s mind. data is bytes object with the length of width * height * 3 (RBG). Note jsonify, serialize, from_json and from_bytes
- class DepthImage(width, height, data)¶
Holds a depth image information from the user’s mind. data is a list of floats with the length of width * height. Note jsonify, serialize, from_json and from_bytes
- class Feelings(hunger, thirst, exhaustion, happiness)¶
Holds feelings information from the user’s mind. All arguments are floats. Note jsonify, serialize, from_json and from_bytes
- class Rotation(x, y, z, w)¶
Holds rotation information from the user’s mind. All arguments are floats. Note jsonify, serialize, from_json and from_bytes
- class Translation(x, y, z)¶
Holds rotation information from the user’s mind. All arguments are floats. Note jsonify, serialize, from_json and from_bytes
- class Pose(translation, rotation)¶
Holds position information from the user’s mind. translation is a Translation object. rotation is a Rotation object. Note jsonify, serialize, from_json and from_bytes
- class Snapshot(datetime, pose, color_image, depth_image, feelings)¶
Holds snapshot information from the user’s mind. datetime is an int type like timestamp from epoch but in milliseconds. pose is a Pose object. color_image is a ColorImage object. depth_image is a DepthImage object. feelings is a Feelings object. Note jsonify, serialize, from_json and from_bytes
- class User(id, name, birthday, gender)¶
Holds user information. id the user id as an int, name the user name as a string, birthday the user birthday since epoch, gender the user gender 0 for male, 1 for female and 2 for other Note jsonify, serialize, from_json and from_bytes
Methods¶
- jsonify(self, path=None) dict¶
Takes all the data in the class and returns it as a dictionary. The path argument is for saving un-jsonify properties to the given path directory. If path is None return a dict that doesn’t necessarily qualifies as json.
- serialize(self) bytes¶
Return the serialized form of the instance.