Commit 54cfbb8d authored by PhiBo's avatar PhiBo 🚀

Get sensor config from sensor node

parent 1f96817d
......@@ -17,6 +17,33 @@ uint8_t ArduRPC_SensorNodeRemote::getMaxSensorCount()
return value;
}
uint8_t ArduRPC_SensorNodeRemote::getSensorConfig(uint8_t sensor_id, uint8_t *data, uint8_t max_length)
{
uint8_t type;
uint8_t length;
uint8_t i;
this->_rpc->reset();
this->_rpc->writeRequest_uint8(sensor_id);
this->_rpc->call(this->_handler_id, 0x11);
type = this->_rpc->readResult_type(RPC_ARRAY);
if(type != RPC_ARRAY) {
return 0;
}
// ToDo: should be UINT8
type = this->_rpc->readResult_raw_uint8();
length = this->_rpc->readResult_raw_uint8();
if(length > max_length) {
length = max_length;
}
for(i = 0; i < length; i++) {
data[i] = this->_rpc->readResult_raw_uint8();
}
return length;
}
uint16_t ArduRPC_SensorNodeRemote::getSensorType(uint8_t sensor_id)
{
uint8_t value;
......
......@@ -70,7 +70,8 @@ class ArduRPC_SensorNodeRemote : public ArduRPCRequestHandler
ArduRPC_SensorNodeRemote(ArduRPCRequest &rpc, uint8_t handler_id);
uint8_t
getMaxSensorCount();
getMaxSensorCount(),
getSensorConfig(uint8_t, uint8_t *, uint8_t);
uint16_t
getSensorType(uint8_t);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment