本文整理汇总了C++中WirelessPacket::nodeRSSI方法的典型用法代码示例。如果您正苦于以下问题:C++ WirelessPacket::nodeRSSI方法的具体用法?C++ WirelessPacket::nodeRSSI怎么用?C++ WirelessPacket::nodeRSSI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WirelessPacket
的用法示例。
在下文中一共展示了WirelessPacket::nodeRSSI方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool LongPing::Response::match(const WirelessPacket& packet)
{
WirelessPacket::Payload payload = packet.payload();
//check the main bytes of the packet
if( packet.deliveryStopFlags().toInvertedByte() != 0x07 || //delivery stop flag
packet.type() != 0x02 || //app data type
packet.nodeAddress() != m_nodeAddress || //node address
payload.size() != 0x02 || //payload length
payload.read_uint16(0) != 0x0000
)
{
//failed to match some of the bytes
return false;
}
//if we made it here, the packet matches the response pattern
//store the node and base RSSI values with the PingResponse
m_result = PingResponse::ResponseSuccess(packet.nodeRSSI(), packet.baseRSSI());
//we have fully matched the response
m_fullyMatched = true;
//notify that the response was matched
m_matchCondition.notify();
m_success = true;
return true;
}
示例2: parseSweeps
AsyncDigitalAnalogPacket::AsyncDigitalAnalogPacket(const WirelessPacket& packet)
{
//construct the data packet from the wireless packet passed in
m_nodeAddress = packet.nodeAddress();
m_deliveryStopFlags = packet.deliveryStopFlags();
m_type = packet.type();
m_nodeRSSI = packet.nodeRSSI();
m_baseRSSI = packet.baseRSSI();
m_frequency = packet.frequency();
m_payload = packet.payload();
m_payloadOffsetChannelData = PAYLOAD_OFFSET_CHANNEL_DATA;
//parse the data sweeps in the packet
parseSweeps();
}
示例3:
HclSmartBearing_RawPacket::HclSmartBearing_RawPacket(const WirelessPacket& packet)
{
//construct the data packet from the wireless packet passed in
m_nodeAddress = packet.nodeAddress();
m_deliveryStopFlags = packet.deliveryStopFlags();
m_type = packet.type();
m_nodeRSSI = packet.nodeRSSI();
m_baseRSSI = packet.baseRSSI();
m_frequency = packet.frequency();
m_payload = packet.payload();
m_payloadOffsetChannelData = 0; //not used for these packets
//parse the data sweeps in the packet
parseSweeps();
}
示例4: savePoint
WirelessParser::ParsePacketResult WirelessParser::parseAsPacket_ASPP_v2(DataBuffer& data, WirelessPacket& packet, WirelessTypes::Frequency freq)
{
//Assume we are at the start of the packet, read the packet header
//byte 1 - Start Of Packet
//byte 2 - Delivery Stop Flag
//byte 3 - App Data Type
//byte 4 - 7 - Node Address (uint32)
//byte 8 - 9 - Payload Length
//byte 10 to N-4 - Payload
//byte N-3 - Node RSSI
//byte N-2 - Base RSSI
//byte N-1 - Fletcher Checksum (MSB)
//byte N - Fletcher Checksum (LSB)
//create a save point for the DataBuffer
ReadBufferSavePoint savePoint(&data);
std::size_t totalBytesAvailable = data.bytesRemaining();
//we need at least 13 bytes for any ASPP v2 packet (if empty payload)
if(totalBytesAvailable < 13)
{
//Not Enough Data to tell if valid packet
return parsePacketResult_notEnoughData;
}
//read byte 1
uint8 startOfPacket = data.read_uint8(); //Start Of Packet
//verify that the first byte is the Start Of Packet
if(startOfPacket != WirelessPacket::ASPP_V2_START_OF_PACKET_BYTE)
{
//Invalid Packet
return parsePacketResult_invalidPacket;
}
//read byte 2
uint8 deliveryStopFlag = data.read_uint8(); //Delivery Stop Flag
//read byte 3
uint8 appDataType = data.read_uint8(); //App Data Type
//read bytes 4 - 7
uint32 nodeAddress = data.read_uint32(); //Node Address
//read bytes 8 and 9
uint16 payloadLength = data.read_uint16(); //Payload Length
//determine the full packet length
size_t packetLength = payloadLength + WirelessPacket::ASPP_V2_NUM_BYTES_BEFORE_PAYLOAD + WirelessPacket::ASPP_V2_NUM_BYTES_AFTER_PAYLOAD;
//the DataBuffer must be large enough to hold the rest of the packet
if(totalBytesAvailable < packetLength)
{
//Not Enough Data to tell if valid packet
return parsePacketResult_notEnoughData;
}
//create the Bytes vector to hold the payload bytes
Bytes payload;
payload.reserve(payloadLength);
//loop through the payload
for(uint16 payloadItr = 0; payloadItr < payloadLength; payloadItr++)
{
//store the payload bytes
payload.push_back(data.read_uint8()); //Payload Bytes
}
//read the node RSSI
uint8 nodeRSSI = data.read_uint8(); //Node RSSI
//read the base station rssi
uint8 baseRSSI = data.read_uint8(); //Base RSSI
//get the checksum sent in the packet
uint16 checksum = data.read_uint16(); //Checksum
//build the checksum to calculate from all the bytes
ChecksumBuilder calcChecksum;
calcChecksum.append_uint8(startOfPacket);
calcChecksum.append_uint8(deliveryStopFlag);
calcChecksum.append_uint8(appDataType);
calcChecksum.append_uint32(nodeAddress);
calcChecksum.append_uint16(payloadLength);
calcChecksum.appendBytes(payload);
calcChecksum.append_uint8(nodeRSSI);
calcChecksum.append_uint8(baseRSSI);
//verify that the returned checksum is the same as the one we calculated
if(checksum != calcChecksum.fletcherChecksum())
{
//Bad Checksum
return parsePacketResult_badChecksum;
}
DeliveryStopFlags flags = DeliveryStopFlags::fromByte(deliveryStopFlag);
//add all the info about the packet to the WirelessPacket reference passed in
packet.deliveryStopFlags(flags);
//.........这里部分代码省略.........