bool GetDeviceDescriptorSets::Response::match_data(const InertialDataField& field) { InertialPacket::Payload fieldData(field.fieldData()); //verify the field is the minimum size if(fieldData.size() < 2) { return false; } //call match from the super class as well return GenericInertialCommand::Response::match_data(field); }
bool GetDeviceInfo::Response::match_data(const InertialDataField& field) { static const uint8 FIELD_DATA_LEN = 82; //verify the field data size is correct if(field.fieldData().size() != FIELD_DATA_LEN) { return false; } //call match from the super class as well return GenericInertialCommand::Response::match_data(field); }
void InertialFieldParser::parseField(const InertialDataField& field, InertialDataPoints& result) { //get the static parser map ParserMap& parsers = getParserMap(); InertialTypes::ChannelField chField = static_cast<InertialTypes::ChannelField>(field.fieldId()); //try to find a parser in our map that can parse this field type std::map<InertialTypes::ChannelField, const InertialFieldParser*>::const_iterator itr = parsers.find(chField); //if we can find a parser for this field type if(itr != parsers.end()) { //parse the field for data itr->second->parse(field, result); } //if we failed to find a parser for this field type else { //just add a data point of this whole field as bytes result.push_back(InertialDataPoint(chField, InertialTypes::CH_UNKNOWN, valueType_Bytes, anyType(field.fieldData().data()), true)); } }