Skip to content

Commit

Permalink
add LQI, last byte vSL_WriteMessage
Browse files Browse the repository at this point in the history
original by
Fairesoimeme <akila@faire-ca-soi-meme.fr>
  • Loading branch information
fairecasoimeme authored and G1K committed Jan 19, 2021
1 parent 305ac12 commit beff742
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 66 deletions.
6 changes: 5 additions & 1 deletion Source/ZigbeeNodeControlBridge/SerialLink.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,18 @@ PUBLIC bool bSL_ReadMessage(uint16 *pu16Type, uint16 *pu16Length, uint16 u16MaxL
* u16Type R Message type
* u16Length R Message length
* pu8Data R Message payload
* u8LinkQuality R Message radio quality
* RETURNS:
* void
****************************************************************************/
PUBLIC void vSL_WriteMessage(uint16 u16Type, uint16 u16Length, uint8 *pu8Data)
PUBLIC void vSL_WriteMessage(uint16 u16Type, uint16 u16Length, uint8 *pu8Data, uint8 u8LinkQuality)
{
int n;
uint8 u8CRC;

u16Length++;

pu8Data[u16Length-1]=u8LinkQuality;
u8CRC = u8SL_CalculateCRC(u16Type, u16Length, pu8Data);

DBG_vPrintf(DEBUG_SL, "\nvSL_WriteMessage(%d, %d, %02x)", u16Type, u16Length, u8CRC);
Expand Down
2 changes: 1 addition & 1 deletion Source/ZigbeeNodeControlBridge/SerialLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ typedef struct
/****************************************************************************/

PUBLIC bool bSL_ReadMessage(uint16 *pu16Type, uint16 *pu16Length, uint16 u16MaxLength, uint8 *pu8Message,uint8 u8Byte);
PUBLIC void vSL_WriteMessage(uint16 u16Type, uint16 u16Length, uint8 *pu8Data);
PUBLIC void vSL_WriteMessage(uint16 u16Type, uint16 u16Length, uint8 *pu8Data, uint8 u8LinkQuality);
PUBLIC uint8 u8SL_CalculateCRC(uint16 u16Type, uint16 u16Length, uint8 *pu8Data);
/****************************************************************************/
/*** Local Functions ***/
Expand Down
30 changes: 20 additions & 10 deletions Source/ZigbeeNodeControlBridge/app_Znc_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,12 @@ PUBLIC void APP_vProcessIncomingSerialCommands ( uint8 u8RxByte )
ZNC_BUF_U16_UPD ( &au8values[ 2 ], u16PacketType, u8Length );
vSL_WriteMessage ( E_SL_MSG_STATUS,
u8Length,
au8values );
au8values,
0 );
vSL_WriteMessage ( E_SL_MSG_VERSION_LIST,
sizeof ( uint32 ),
( uint8* ) &u32Version );
( uint8* ) &u32Version,
0 );
return;
}
break;
Expand Down Expand Up @@ -1997,7 +1999,8 @@ PUBLIC void APP_vProcessIncomingSerialCommands ( uint8 u8RxByte )
vNetworkRecoveryObtainRecoverData ( &sNwkRecovery );
vSL_WriteMessage( E_SL_MSG_NWK_RECOVERY_EXTRACT_RSP,
sizeof(sNwkRecovery),
(uint8 *)&sNwkRecovery );
(uint8 *)&sNwkRecovery,
0 );
}
break;

Expand All @@ -2007,7 +2010,8 @@ PUBLIC void APP_vProcessIncomingSerialCommands ( uint8 u8RxByte )
vNetworkRecoveryInsertRecoverData( ( tsNwkRecovery * ) &au8LinkRxBuffer );
vSL_WriteMessage( E_SL_MSG_NWK_RECOVERY_RESTORE_RSP,
sizeof(uint8),
&u8Success );
&u8Success,
0 );
}
break;
#endif
Expand Down Expand Up @@ -2207,7 +2211,8 @@ PUBLIC void APP_vProcessIncomingSerialCommands ( uint8 u8RxByte )
ZNC_BUF_U16_UPD ( &au8values [ 2 ], u16PacketType, u8Length );
vSL_WriteMessage ( E_SL_MSG_STATUS,
u8Length,
au8values );
au8values,
0 );

}

Expand Down Expand Up @@ -2956,7 +2961,8 @@ PRIVATE void APP_vControlNodeScanStart(void)
au8Buffer[0] = u8Status;
vSL_WriteMessage ( E_SL_MSG_NETWORK_JOINED_FORMED,
sizeof(uint8) ,
au8Buffer );
au8Buffer,
0 );
}
return;
}
Expand Down Expand Up @@ -3019,7 +3025,8 @@ PRIVATE void APP_vControlNodeStartNetwork(void)
au8Buffer[0] = u8Status;
vSL_WriteMessage ( E_SL_MSG_NETWORK_JOINED_FORMED,
sizeof(uint8) ,
au8Buffer );
au8Buffer,
0 );
}
}
#ifdef FULL_FUNC_DEVICE
Expand Down Expand Up @@ -3312,7 +3319,8 @@ PUBLIC void APP_vSendJoinedFormEventToHost ( uint8 u8FormJoin,
APP_vSaveAllRecords();
vSL_WriteMessage ( E_SL_MSG_NETWORK_JOINED_FORMED,
( sizeof(uint8) + sizeof(uint16) + sizeof(uint64) + sizeof(uint8) ),
pu8Buffer );
pu8Buffer,
0 );
ZTIMER_eStart ( u8TmrToggleLED, s_sLedState.u32LedToggleTime );

/* Initialise the OTA */
Expand Down Expand Up @@ -3620,7 +3628,8 @@ PUBLIC void APP_vIdentifyEffect ( void* pvParam )
ZTIMER_eStart( u8IdTimer, ZTIMER_TIME_MSEC (u16IdentifyTime));
vSL_WriteMessage ( E_SL_MSG_IDENTIFY_LOCAL_ACTIVE,
sizeof(uint8),
&u8Status );
&u8Status,
0 );
}

/****************************************************************************
Expand All @@ -3646,7 +3655,8 @@ PUBLIC void APP_vIdentifyEffectEnd ( void* pvParam )
{
vSL_WriteMessage ( E_SL_MSG_IDENTIFY_LOCAL_ACTIVE,
sizeof(uint8),
&u8Status );
&u8Status,
0 );
}
}
/****************************************************************************
Expand Down
Loading

0 comments on commit beff742

Please sign in to comment.