BrainBit for developers Subscribe for updates Visit website

Info about device

Parameters

Each device has its own settings, and some of them can be configured as you need. Not all settings can be changed and not every device supports all settings.

First you need to find out what parameters the device supports and whether they can be changed:

int32_t szSensorParametersInOut = getParametersCountSensor(sensor);
ParameterInfo sensor_parameter[szSensorParametersInOut];
OpStatus outStatus;
getParametersSensor(sensor, sensor_parameter, &szSensorParametersInOut, &outStatus);
            
List<ParameterInfo> parameters = sensor.getSupportedParameters();
parameters.forEach(parameter -> Log.i("TAG", parameter.getParam() + ": " + parameter.getParamAccess()));

// Output:
// 
// ParameterGain: ReadWrite  
// ParameterState: ReadNotify
            
val parameters = sensor.supportedParameters
parameters?.forEach { parameter ->
    Log.i(
        "TAG",
        "${parameter.param}: ${parameter.paramAccess}"
    )
}

// Output:
// 
// ParameterGain: ReadWrite  
// ParameterState: ReadNotify
            
var parameters = sensor.Parameters;
            
console.log(sensor.Parameters.map(parameter => SensorParameter[parameter.Param] + ": " + SensorParamAccess[parameter.ParamAccess]))

// Output:
//
// ["Name: Read", 
// "FirmwareMode: Read", 
// "FirmwareVersion: Read", 
// "State: ReadNotify", ... ]
            
print(sensor.parameters) 

# Output:
# 
# [ParameterInfo(Param=<SensorParameter.ParameterOffset: 8>, ParamAccess=<SensorParamAccess.ParamAccessRead: 0>),  
# ParameterInfo(Param=<SensorParameter.ParameterState: 1>,  ParamAccess=<SensorParamAccess.ParamAccessReadNotify: 2>)
# ...]
            
var parameters = sensor?.parameters
            
NSArray<NTParameterInfo*>* parameters = [sensor Parameters];
            

 

Info about parameter includes two fields:

**ParameterInfo**
| Field | Type | Description |
|--|--|--|
|Param|SensorParameter|the name of the parameter, represented by an enumeration|
|ParamAccess|SensorParamAccess|parameter availability for manipulation|

**SensorParamAccess**
| Field | Value | Description |
|--|--|--|
|ParamAccessRead|0|read-only|
|ParamAccessReadWrite|1|parameter can be changed|
|ParamAccessReadNotify|2|parameter is updated over time|
            
**ParameterInfo**
| Field | Type | Description |
|--|--|--|
|Param|SensorParameter|the name of the parameter, represented by an enumeration|
|ParamAccess|SensorParamAccess|parameter availability for manipulation|

**SensorParamAccess**
| Field | Value | Description |
|--|--|--|
|Read|0|read-only|
|ReadWrite|1|parameter can be changed|
|ReadNotify|2|parameter is updated over time|
            
**ParameterInfo**
| Field | Type | Description |
|--|--|--|
|param|SensorParameter|the name of the parameter, represented by an enumeration|
|paramAccess|SensorParamAccess|parameter availability for manipulation|

**SensorParamAccess**
| Field | Value | Description |
|--|--|--|
|Read|0|read-only|
|ReadWrite|1|parameter can be changed|
|ReadNotify|2|parameter is updated over time|
            
**ParameterInfo**
| Field | Type | Description |
|--|--|--|
|Param|SensorParameter|the name of the parameter, represented by an enumeration|
|ParamAccess|SensorParamAccess|parameter availability for manipulation|

**SensorParamAccess**
| Field | Value | Description |
|--|--|--|
|Read|0|read-only|
|ReadWrite|1|parameter can be changed|
|ReadNotify|2|parameter is updated over time|
            
**ParameterInfo**
| Field | Type | Description |
|--|--|--|
|Param|SensorParameter|the name of the parameter, represented by an enumeration|
|ParamAccess|SensorParamAccess|parameter availability for manipulation|

**SensorParamAccess**
| Field | Value | Description |
|--|--|--|
|Read|0|read-only|
|ReadWrite|1|parameter can be changed|
|ReadNotify|2|parameter is updated over time|
            
**ParameterInfo**
| Field | Type | Description |
|--|--|--|
|Param|SensorParameter|the name of the parameter, represented by an enumeration|
|ParamAccess|SensorParamAccess|parameter availability for manipulation|

**SensorParamAccess**
| Field | Value | Description |
|--|--|--|
|Read|0|read-only|
|ReadWrite|1|parameter can be changed|
|ReadNotify|2|parameter is updated over time|
            
**NTParameterInfo**
| Field | Type | Description |
|--|--|--|
|param|NTSensorParameter?|the name of the parameter, represented by an enumeration|
|paramAccess|NTSensorParamAccess?|parameter availability for manipulation|

**NTSensorParamAccess**
| Field | Value | Description |
|--|--|--|
|read|0|read-only|
|readWrite|1|parameter can be changed|
|readNotify|2|parameter is updated over time|
            
**NTParameterInfo**
| Field | Type | Description |
|--|--|--|
|Param|enum NTSensorParameter|the name of the parameter, represented by an enumeration|
|ParamAccess|enum NTSensorParamAccess|parameter availability for manipulation|

**NTSensorParamAccess**
| Field | Value | Description |
|--|--|--|
|NTSensorParamAccessRead|0|read-only|
|NTSensorParamAccessReadWrite|1|parameter can be changed|
|NTSensorParamAccessReadNotify|2|parameter is updated over time|
            

 

You can also check if the parameter is supported, for example `Gain`:

if(isSupportedParameterSensor(sensor, SensorParameter::ParameterGain)){
    ...
}
            
if(sensor.isSupportedParameter(SensorParameter.ParameterGain)){
...
}
            
if(sensor.isSupportedParameter(SensorParameter.ParameterGain) == true){
...
}
            
if(sensor.IsSupportedParameter(SensorParameter.ParameterGain)){
...
}
            
if(sensor.IsSupportedParameter(SensorParameter.Gain)){
    ...
}
            
if sensor.is_supported_parameter(SensorParameter.Gain):
    ...
            
if(sensor?.isSupportedParameter(.gain)){
...
}
            
if([sensor IsSupportedParameter:NTSensorParameterGain]){
...
}
            

 

You can learn more about each parameter in the paragraph "Parameter description".

Features

Each device has a specific set of modules. You can find out which modules the device has using the parameter `Feature`:

int32_t szSensorFeatureInOut = getFeaturesCountSensor(sensor);
SensorFeature features[szSensorFeatureInOut];
OpStatus outStatus;
getFeaturesSensor(sensor, features, &szSensorFeatureInOut, &outStatus);
            
List<SensorFeature> features = sensor.getSupportedFeature();
features.forEach(feature -> Log.i("TAG", feature.toString()));

// Output:
//
// Signal
// Resistance
            
val features = sensor.supportedFeatures
features!!.forEach { feature: SensorFeature ->
    Log.i(
        "TAG",
        feature.toString()
    )
}

// Output:
//
// Signal
// Resistance
            
var features = sensor.Features;
            
console.log(sensor.Features.map(feature => SensorFeature[feature]))

// Output:
//
// ["Signal", "Resist"]
            
print(sensor.features) 

# Output:
# 
# [<SensorFeature.FeatureSignal: 0>, ...]
            
var features = sensor.Features
            
NSArray<NSNumber*>* features = [sensor Features];
            

 

You can also check if the feature is supported, for example `Signal`:

if(isSupportedFeatureSensor(sensor, SensorFeature::FeatureSignal)){

}
            
if(sensor.isSupportedFeature(SensorFeature.Signal)){
...
}
            
if(sensor.isSupportedFeature(SensorFeature.Signal) == true){
...
}
            
if(sensor.IsSupportedFeature(SensorFeature.FeatureSignal)){
...
}
            
if(sensor.IsSupportedFeature(SensorFeature.Signal)){
    ...
}
            
if sensor.is_supported_feature(SensorFeature.FeatureSignal):
    ...
            
if(sensor.isSupportedFeature(.signal)){
...
}
            
if([sensor IsSupportedFeature:NTSensorFeatureSignal]){
...
}
            

 

Commands

The device can execute certain commands. The list of supported commands can be obtained as follows:

auto* sensor = reinterpret_cast<Sensor*>(sensor_ptr);
int32_t szSensorCommandsInOut = getCommandsCountSensor(sensor);
SensorCommand commands[szSensorCommandsInOut];
OpStatus outStatus;
getCommandsSensor(sensor, commands, &szSensorCommandsInOut, &outStatus);
            
List<SensorCommand> commands = sensor.getCommands();
commands.forEach(command -> Log.i("TAG", command.toString()));

// Output:
//
// StartSignal
// StopSignal
// StartResist
// StopResist
            
val commands = sensor.commands
commands!!.forEach { command: SensorCommand ->
    Log.i(
        "TAG",
        command.toString()
    )
}

// Output:
//
// StartSignal
// StopSignal
// StartResist
// StopResist
            
var commands = sensor.Commands;
            
console.log(sensor.Commands.map(command => SensorCommand[command]))

// Output:
//
// ["StartSignal", "StopSignal", ...]
            
print(sensor.commands) 

# Output:
# 
# [<SensorCommand.CommandStartSignal: 0>,...]
            
var commands = sensor.commands
            
NSArray<NSNumber*>* commands = [sensor Commands];
            

 

And also check if the device can execute the desired command:

if(isSupportedCommandSensor(sensor, SensorCommand::CommandStartSignal)){

}
            
if(sensor.isSupportedCommand(SensorCommand.StartSignal)){
...
}
            
if(sensor.isSupportedCommand(SensorCommand.StartSignal) == true){
...
}
            
if(sensor.IsSupportedCommand(SensorCommand.StartSignal)){
...
}
            
if(sensor.IsSupportedCommand(SensorCommand.StartSignal)){
    ...
}
            
if sensor.is_supported_command(SensorCommand.StartSignal):
    ...
            
if(sensor.isSupportedCommand(.startSignal)){
...
}
            
if([sensor IsSupportedCommand:NTSensorCommandStartSignal]){
...
}