blue_st_sdk.features package

Submodules

blue_st_sdk.features.device_timestamp_feature module

class blue_st_sdk.features.device_timestamp_feature.DeviceTimestampFeature(name, node, description)[source]

Bases: blue_st_sdk.feature.Feature

Class that a feature has to extend if it doesn’t have the timestamp field. The system time is used as timestamp.

Refer to Heart Rate Measurement Specs for more information.

__init__(name, node, description)[source]

Constructor.

Args:
name (str): Name of the feature. node (blue_st_sdk.node.Node): Node that will update the feature. description (str): Description of the data of the feature.

blue_st_sdk.features.feature_accelerometer module

class blue_st_sdk.features.feature_accelerometer.FeatureAccelerometer(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the data coming from an accelerometer sensor.

Data is six bytes long and has no decimal digits.

DATA_LENGTH_BYTES = 6
DATA_MAX = 2000
DATA_MIN = -2000
FEATURE_DATA_NAME = ['X', 'Y', 'Z']
FEATURE_NAME = 'Accelerometer'
FEATURE_UNIT = 'mg'
FEATURE_X_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_Y_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_Z_FIELD = <blue_st_sdk.features.field.Field object>
X_INDEX = 0
Y_INDEX = 1
Z_INDEX = 2
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_accelerometer_x(sample)[source]

Get the accererometer value on the X axis from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The accelerometer value on the X axis if the data array is valid, <nan> otherwise.
classmethod get_accelerometer_y(sample)[source]

Get the accererometer value on the Y axis from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The accelerometer value on the Y axis if the data array is valid, <nan> otherwise.
classmethod get_accelerometer_z(sample)[source]

Get the accererometer value on the Z axis from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The accelerometer value on the Z axis if the data array is valid, <nan> otherwise.
read_accelerometer()[source]

Read the accelerometer values.

Returns:
list: The accelerometer values on the three axis if the read operation is successful, <nan> values otherwise.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.

blue_st_sdk.features.feature_activity_recognition module

class blue_st_sdk.features.feature_activity_recognition.ActivityType[source]

Bases: enum.Enum

Allowed activities.

BIKING = 5
DRIVING = 6
ERROR = 8
FASTWALKING = 3
JOGGING = 4
NO_ACTIVITY = 0
STAIRS = 7
STATIONARY = 1
WALKING = 2
class blue_st_sdk.features.feature_activity_recognition.FeatureActivityRecognition(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the activities that can be detected by a device.

Data is one or two bytes long and has no decimal digits.

ACTIVITY_INDEX = 0
ALGORITHM_INDEX = 2
DATA_LENGTH_BYTES = 1
DATA_MAX = 7
DATA_MIN = 0
FEATURE_ACTIVITY_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_ALGORITHM_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_DATA_NAME = ['Activity', 'DateTime', 'Algorithm']
FEATURE_NAME = 'Activity Recognition'
FEATURE_TIME_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_UNIT = [None, 'ms', None]
TIME_FIELD = 1
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_activity(sample)[source]

Getting the recognized activity from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
ActivityType: The recognized activity if the sample is valid, “ActivityType.ERROR” otherwise.
classmethod get_algorithm(sample)[source]

Getting the algorithm from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
int: The algorithm if the sample is valid, “0” otherwise.
classmethod get_time(sample)[source]

Getting the date and the time from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
datetime: The date and the time of the recognized activity if the sample is valid, “None” otherwise. Refer to datetime for more information.

blue_st_sdk.features.feature_audio_scene_classification module

class blue_st_sdk.features.feature_audio_scene_classification.FeatureAudioSceneClassification(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the type of scene that can be detected by a device.

Data is one byte long and has no decimal digits.

DATA_LENGTH_BYTES = 1
DATA_MAX = 3
DATA_MIN = 0
FEATURE_DATA_NAME = 'SceneType'
FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
FEATURE_NAME = 'Audio Scene Classification'
FEATURE_UNIT = None
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_scene(sample)[source]

Getting the scene from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
SceneType: The type of the scene if the sample is valid, “SceneType.ERROR” otherwise.
class blue_st_sdk.features.feature_audio_scene_classification.SceneType[source]

Bases: enum.Enum

Type of scene.

ERROR = 3
INDOOR = 0
IN_VEHICLE = 2
OUTDOOR = 1
UNKNOWN = -1

blue_st_sdk.features.feature_gyroscope module

class blue_st_sdk.features.feature_gyroscope.FeatureGyroscope(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the data coming from a gyroscope sensor.

Data is six bytes long and has one decimal digit.

DATA_LENGTH_BYTES = 6
DATA_MAX = 3276.8
DATA_MIN = -3276.8
FEATURE_DATA_NAME = ['X', 'Y', 'Z']
FEATURE_NAME = 'Gyroscope'
FEATURE_UNIT = 'dps'
FEATURE_X_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_Y_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_Z_FIELD = <blue_st_sdk.features.field.Field object>
SCALE_FACTOR = 10.0
X_INDEX = 0
Y_INDEX = 1
Z_INDEX = 2
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_gyroscope_x(sample)[source]

Get the gyroscope value on the X axis from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The gyroscope value on the X axis if the data array is valid, <nan> otherwise.
classmethod get_gyroscope_y(sample)[source]

Get the gyroscope value on the Y axis from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The gyroscope value on the Y axis if the data array is valid, <nan> otherwise.
classmethod get_gyroscope_z(sample)[source]

Get the gyroscope value on the Z axis from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The gyroscope value on the Z axis if the data array is valid, <nan> otherwise.
read_gyroscope()[source]

Read the gyroscope values.

Returns:
list: The gyroscope values on the three axis if the read operation is successful, <nan> values otherwise.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.

blue_st_sdk.features.feature_humidity module

class blue_st_sdk.features.feature_humidity.FeatureHumidity(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the data coming from a humidity sensor.

Data is two bytes long and has one decimal digit.

DATA_LENGTH_BYTES = 2
DATA_MAX = 100
DATA_MIN = 0
FEATURE_DATA_NAME = 'Humidity'
FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
FEATURE_NAME = 'Humidity'
FEATURE_UNIT = '%'
SCALE_FACTOR = 10.0
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_humidity(sample)[source]

Get the humidity value from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The humidity value if the data array is valid, <nan> otherwise.
read_humidity()[source]

Read the humidity value.

Returns:
float: The humidity value if the read operation is successful, <nan> otherwise.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.

blue_st_sdk.features.feature_magnetometer module

class blue_st_sdk.features.feature_magnetometer.FeatureMagnetometer(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the data coming from a magnetometer sensor.

Data is six bytes long and has no decimal digits.

DATA_LENGTH_BYTES = 6
DATA_MAX = 2000
DATA_MIN = -2000
FEATURE_DATA_NAME = ['X', 'Y', 'Z']
FEATURE_NAME = 'Magnetometer'
FEATURE_UNIT = 'mGa'
FEATURE_X_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_Y_FIELD = <blue_st_sdk.features.field.Field object>
FEATURE_Z_FIELD = <blue_st_sdk.features.field.Field object>
X_INDEX = 0
Y_INDEX = 1
Z_INDEX = 2
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_magnetometer_x(sample)[source]

Get the magnetometer value on the X axis from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The magnetometer value on the X axis if the data array is valid, <nan> otherwise.
classmethod get_magnetometer_y(sample)[source]

Get the magnetometer value on the Y axis from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The magnetometer value on the Y axis if the data array is valid, <nan> otherwise.
classmethod get_magnetometer_z(sample)[source]

Get the magnetometer value on the Z axis from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The magnetometer value on the Z axis if the data array is valid, <nan> otherwise.
read_magnetometer()[source]

Read the magnetometer values.

Returns:
list: The magnetometer values on the three axis if the read operation is successful, <nan> values otherwise.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.

blue_st_sdk.features.feature_pressure module

class blue_st_sdk.features.feature_pressure.FeaturePressure(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the data coming from a pressure sensor.

Data is four bytes long and has two decimal digits.

DATA_LENGTH_BYTES = 4
DATA_MAX = 2000
DATA_MIN = 0
FEATURE_DATA_NAME = 'Pressure'
FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
FEATURE_NAME = 'Pressure'
FEATURE_UNIT = 'mBar'
SCALE_FACTOR = 100.0
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_pressure(sample)[source]

Get the pressure value from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The pressure value if the data array is valid, <nan> otherwise.
read_pressure()[source]

Read the pressure value.

Returns:
float: The pressure value if the read operation is successful, <nan> otherwise.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.

blue_st_sdk.features.feature_proximity module

class blue_st_sdk.features.feature_proximity.FeatureProximity(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the data coming from a proximity sensor.

Data is two bytes long and has no decimal digits.

DATA_LENGTH_BYTES = 2
DATA_MIN = 0
FEATURE_DATA_NAME = 'Proximity'
FEATURE_NAME = 'Proximity'
FEATURE_UNIT = 'mm'
HIGH_RANGE_DATA_MAX = 32766
HIGH_RANGE_FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
LOW_RANGE_DATA_MAX = 254
LOW_RANGE_FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
OUT_OF_RANGE_VALUE = 65535
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_proximity_distance(sample)[source]

Extract the data from the feature’s raw data.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
int: The proximity distance value if the data array is valid, “-1” otherwise.
classmethod is_out_of_range_distance(sample)[source]

Check if the measure is out of range_value.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
bool: True if the proximity distance is out of range_value, False otherwise.

blue_st_sdk.features.feature_proximity_gesture module

class blue_st_sdk.features.feature_proximity_gesture.FeatureProximityGesture(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the detected gesture using proximity sensors.

Data is one byte long and has no decimal digits.

DATA_LENGTH_BYTES = 1
DATA_MAX = 4
DATA_MIN = 0
FEATURE_DATA_NAME = 'Gesture'
FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
FEATURE_NAME = 'Gesture'
FEATURE_UNIT = None
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_gesture(sample)[source]

Get the gesture value from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
blue_st_sdk.features.feature_proximity_gesture.Gesture: The gesture value from a sample.
class blue_st_sdk.features.feature_proximity_gesture.Gesture[source]

Bases: enum.Enum

This class summarizes the types of gesture that can be recognized.

ERROR = 4
LEFT = 2
RIGHT = 3
TAP = 1
UNKNOWN = 0

blue_st_sdk.features.feature_stepper_motor module

class blue_st_sdk.features.feature_stepper_motor.FeatureStepperMotor(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles a stepper motor.

It can be read or written and behaves differently depending on this. When read, the data read is the status of the motor, and is one byte long. When written, the data written is the command to be executed, and can be either one or five bytes long (see blue_st_sdk.features.feature_stepper_motor.FeatureStepperMotor.write_motor_command() method).

COMMAND_DATA_LENGTH_BYTES = 5
COMMAND_FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
FEATURE_NAME = 'Stepper Motor'
STATUS_DATA_LENGTH_BYTES = 1
STATUS_FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_motor_status(sample)[source]

Get the motor status.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
StepperMotorStatus: The motor status if the sample is valid, “None” otherwise.
read_motor_status()[source]

Read the motor status.

Returns:
StepperMotorStatus: The motor status.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
write_motor_command(command, steps=0)[source]

Write the motor command.

Args:
command (StepperMotorCommands):
The command to be written.
steps (int): The number of steps to perform, if required by the
command.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.
class blue_st_sdk.features.feature_stepper_motor.StepperMotorCommands[source]

Bases: enum.Enum

This class lists the types of commands that can be given to a stepper motor.

MOTOR_MOVE_STEPS_BACKWARD = 5
MOTOR_MOVE_STEPS_FORWARD = 4
MOTOR_RUN_BACKWARD = 3
MOTOR_RUN_FORWARD = 2
MOTOR_STOP_RUNNING_WITHOUT_TORQUE = 0
MOTOR_STOP_RUNNING_WITH_TORQUE = 1
class blue_st_sdk.features.feature_stepper_motor.StepperMotorStatus[source]

Bases: enum.Enum

This class lists the types of status in which a stepper motor can found itself.

MOTOR_INACTIVE = 0
MOTOR_RUNNING = 1

blue_st_sdk.features.feature_switch module

class blue_st_sdk.features.feature_switch.FeatureSwitch(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles an 8-bit switch status register, thus handling up to 8 switches.

Data is one byte long and has no decimal digits.

DATA_LENGTH_BYTES = 1
DATA_MAX = 256
DATA_MIN = 0
FEATURE_DATA_NAME = 'Status'
FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
FEATURE_NAME = 'Switch'
FEATURE_UNIT = None
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_switch_status(sample)[source]

Get the switch status.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
int: The switch status if the sample is valid, “-1” otherwise.
read_switch_status()[source]

Read the switch status.

Returns:
int: The switch status.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
write_switch_status(status)[source]

Write the switch status.

Args:
status (int): The switch status.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.

blue_st_sdk.features.feature_temperature module

class blue_st_sdk.features.feature_temperature.FeatureTemperature(node)[source]

Bases: blue_st_sdk.feature.Feature

The feature handles the data coming from a temperature sensor.

Data is two bytes long and has one decimal digit.

DATA_LENGTH_BYTES = 2
DATA_MAX = 100
DATA_MIN = 0
FEATURE_DATA_NAME = 'Temperature'
FEATURE_FIELDS = <blue_st_sdk.features.field.Field object>
FEATURE_NAME = 'Temperature'
FEATURE_UNIT = 'C'
SCALE_FACTOR = 10.0
__init__(node)[source]

Constructor.

Args:
node (blue_st_sdk.node.Node): Node that will send data to
this feature.
extract_data(timestamp, data, offset)[source]

Extract the data from the feature’s raw data.

Args:
timestamp (int): Data’s timestamp. data (str): The data read from the feature. offset (int): Offset where to start reading data.
Returns:
blue_st_sdk.feature.ExtractedData: Container of the number of bytes read and the extracted data.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.
classmethod get_temperature(sample)[source]

Get the temperature value from a sample.

Args:
sample (blue_st_sdk.feature.Sample): Sample data.
Returns:
float: The temperature value if the data array is valid, <nan> otherwise.
read_temperature()[source]

Read the temperature value.

Returns:
float: The temperature value if the read operation is successful, <nan> otherwise.
Raises:
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidOperationException
is raised if the feature is not enabled or the operation required is not supported.
blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidDataException
if the data array has not enough data to read.

blue_st_sdk.features.field module

class blue_st_sdk.features.field.Field(name, unit, data_type, maximum, minimum)[source]

Bases: object

Class that describes a feature data field.

__init__(name, unit, data_type, maximum, minimum)[source]

Constructor.

Args:
name (str): Name. unit (str): Unit. data_type (blue_st_sdk.features.field.FieldType): Data type. maximum: Maximum value. minimum: Minimum value.
get_data_type()[source]

Get the data type.

Returns:
blue_st_sdk.features.field.FieldType: The data type.
get_maximum()[source]

Get the maximum value.

Returns:
The maximum value.
get_min()[source]

Get the minimum value.

Returns:
The minimum value.
get_name()[source]

Get the name.

Returns:
str: The name.
get_unit()[source]

Get the unit.

Returns:
str: The unit.
class blue_st_sdk.features.field.FieldType[source]

Bases: enum.Enum

Type of field.

ByteArray = u'ByteArray'
DateTime = u'DateTime'
Float = u'Float'
Int16 = u'Int16'
Int32 = u'Int32'
Int64 = u'Int64'
Int8 = u'Int8'
UInt16 = u'UInt16'
UInt32 = u'UInt32'
UInt8 = u'UInt8'

Module contents