@@ -224,7 +224,7 @@ void LoRaWAN::insertBlockB0(linkDirection theDirection, frameCount& aFrameCount)
224224 rawMessage[12 ] = aFrameCount[2 ];
225225 rawMessage[13 ] = aFrameCount[3 ];
226226 rawMessage[14 ] = 0 ;
227- rawMessage[15 ] = macHeaderLength + frameHeaderLength + framePortLength + framePayloadLength;
227+ rawMessage[15 ] = static_cast < uint8_t >( macHeaderLength + frameHeaderLength + framePortLength + framePayloadLength) ;
228228}
229229
230230void LoRaWAN::padForMicCalculation (const uint32_t messageLength) {
@@ -236,15 +236,15 @@ void LoRaWAN::padForMicCalculation(const uint32_t messageLength) {
236236}
237237
238238uint16_t LoRaWAN::receivedFramecount () {
239- return (static_cast <uint16_t >(rawMessage[frameCountOffset]) + (static_cast <uint16_t >(rawMessage[frameCountOffset + 1 ]) << 8 ));
239+ return (static_cast <uint16_t >(rawMessage[frameCountOffset]) + (static_cast <uint16_t >(rawMessage[frameCountOffset + 1 ]) << 8U ));
240240}
241241
242242uint32_t LoRaWAN::receivedDeviceAddress () {
243- return (static_cast <uint32_t >(rawMessage[deviceAddressOffset]) + (static_cast <uint32_t >(rawMessage[deviceAddressOffset + 1 ]) << 8 ) + (static_cast <uint32_t >(rawMessage[deviceAddressOffset + 2 ]) << 16 ) + (static_cast <uint32_t >(rawMessage[deviceAddressOffset + 3 ]) << 24 ));
243+ return (static_cast <uint32_t >(rawMessage[deviceAddressOffset]) + (static_cast <uint32_t >(rawMessage[deviceAddressOffset + 1 ]) << 8U ) + (static_cast <uint32_t >(rawMessage[deviceAddressOffset + 2 ]) << 16U ) + (static_cast <uint32_t >(rawMessage[deviceAddressOffset + 3 ]) << 24U ));
244244}
245245
246246uint32_t LoRaWAN::receivedMic () {
247- return (static_cast <uint32_t >(rawMessage[micOffset]) + (static_cast <uint32_t >(rawMessage[micOffset + 1 ]) << 8 ) + (static_cast <uint32_t >(rawMessage[micOffset + 2 ]) << 16 ) + (static_cast <uint32_t >(rawMessage[micOffset + 3 ]) << 24 ));
247+ return (static_cast <uint32_t >(rawMessage[micOffset]) + (static_cast <uint32_t >(rawMessage[micOffset + 1 ]) << 8U ) + (static_cast <uint32_t >(rawMessage[micOffset + 2 ]) << 16U ) + (static_cast <uint32_t >(rawMessage[micOffset + 3 ]) << 24U ));
248248};
249249
250250#pragma endregion
@@ -273,7 +273,7 @@ void LoRaWAN::prepareBlockAi(aesBlock& theBlock, linkDirection theDirection, uin
273273 theBlock[13 ] = downlinkFrameCount[3 ]; // MSByte
274274 } //
275275 theBlock[14 ] = 0x00 ; //
276- theBlock[15 ] = blockIndex; // Blocks Ai are indexed from 1..k, where k is the number of blocks
276+ theBlock[15 ] = static_cast < uint8_t >( blockIndex) ; // Blocks Ai are indexed from 1..k, where k is the number of blocks
277277}
278278
279279void LoRaWAN::encryptDecryptPayload (aesKey& theKey, linkDirection theLinkDirection) {
@@ -454,9 +454,9 @@ void LoRaWAN::insertMic() {
454454
455455void LoRaWAN::insertMic (uint32_t aMic) {
456456 rawMessage[micOffset] = aMic & 0x000000FF ; // LSByte
457- rawMessage[micOffset + 1 ] = (aMic & 0x0000FF00 ) >> 8 ; //
458- rawMessage[micOffset + 2 ] = (aMic & 0x00FF0000 ) >> 16 ; //
459- rawMessage[micOffset + 3 ] = (aMic & 0xFF000000 ) >> 24 ; // MSByte
457+ rawMessage[micOffset + 1 ] = (aMic & 0x0000FF00 ) >> 8U ; //
458+ rawMessage[micOffset + 2 ] = (aMic & 0x00FF0000 ) >> 16U ; //
459+ rawMessage[micOffset + 3 ] = (aMic & 0xFF000000 ) >> 24U ; // MSByte
460460}
461461
462462#pragma endregion
0 commit comments