Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotifyNewEndDeviceReq does not contain the MAC command ID #17

Closed
adriansmares opened this issue Sep 21, 2023 · 1 comment
Closed

NotifyNewEndDeviceReq does not contain the MAC command ID #17

adriansmares opened this issue Sep 21, 2023 · 1 comment

Comments

@adriansmares
Copy link

adriansmares commented Sep 21, 2023

When LBM is compiled with relay RX support, the relay can choose to notify the Network Server that an unknown end device has sent a wake-on-radio frame. The current LBM implementation achieves this by sending an uplink on FPort=0, which is fine, but the payload is not prepended by the MAC command ID, which makes parsing on the Network Server not possible.

static void notify_unknonw_ed( const wor_infos_t* wor )
{
decrement_fwd_counter( &relay_fwd_cnt[LIMIT_OVERALL] );
decrement_fwd_counter( &relay_fwd_cnt[LIMIT_NOTIFY] );
int16_t tmp;
uint16_t power_level = 0;
tmp = wor->rf_infos.rssi_in_dbm;
tmp = MIN( -15, tmp );
tmp = MAX( -142, tmp );
power_level |= RELAY_NOTIFY_POWER_LEVEL_UPLINK_RSSI( ( uint8_t )( -( tmp + 15 ) ) );
tmp = wor->rf_infos.snr_in_db;
tmp = MIN( 11, tmp );
tmp = MAX( -20, tmp );
power_level |= RELAY_NOTIFY_POWER_LEVEL_UPLINK_SNR( ( uint8_t )( tmp + 20 ) );
uint8_t buffer[RELAY_NOTIFY_BYTE_ORDER_POWER_LEVEL_LENGTH];
buffer[RELAY_NOTIFY_BYTE_ORDER_DEV_ADDR_7_0] = ( uint8_t )( wor->uplink.devaddr );
buffer[RELAY_NOTIFY_BYTE_ORDER_DEV_ADDR_15_8] = ( uint8_t )( wor->uplink.devaddr >> 8 );
buffer[RELAY_NOTIFY_BYTE_ORDER_DEV_ADDR_23_16] = ( uint8_t )( wor->uplink.devaddr >> 16 );
buffer[RELAY_NOTIFY_BYTE_ORDER_DEV_ADDR_31_24] = ( uint8_t )( wor->uplink.devaddr >> 24 );
buffer[RELAY_NOTIFY_BYTE_ORDER_POWER_LEVEL_7_0] = ( uint8_t )( power_level );
buffer[RELAY_NOTIFY_BYTE_ORDER_POWER_LEVEL_15_8] = ( uint8_t )( power_level >> 8 );
lorawan_api_payload_send( 0, true, buffer, RELAY_NOTIFY_BYTE_ORDER_POWER_LEVEL_LENGTH, UNCONF_DATA_UP,
smtc_modem_hal_get_time_in_ms( ) + 20, RELAY_STACK_ID );
}

Notice that the first element in the buffer is related to the device address of the unknown device, not the MAC command ID (which is decimal 70).

image

It is also the case that this implementation cannot piggy-back an existing uplink (via FOpts), but that's another problem.

@lbm-team
Copy link
Contributor

Hello,

This issue was solved in the release v4.4.0-feature-relay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants