34
34
35
35
static int fhss_ws_handle_state_set (fhss_structure_t * fhss_structure , fhss_states fhss_state , uint16_t pan_id )
36
36
{
37
+ (void ) fhss_state ;
37
38
(void ) pan_id ;
38
39
//TODO: Remove hard coded channel function
39
40
fhss_structure -> ws -> channel_function = WS_TR51CF ;
@@ -43,7 +44,7 @@ static int fhss_ws_handle_state_set(fhss_structure_t *fhss_structure, fhss_state
43
44
44
45
static void fhss_ws_superframe_callback (fhss_structure_t * fhss_structure )
45
46
{
46
-
47
+ ( void ) fhss_structure ;
47
48
}
48
49
49
50
static void fhss_ws_update_channel_callback (fhss_structure_t * fhss_structure )
@@ -65,18 +66,50 @@ static void fhss_ws_update_channel_callback(fhss_structure_t *fhss_structure)
65
66
//TODO: Callback to get channel schedule from application
66
67
}
67
68
#ifdef FHSS_CHANNEL_DEBUG
68
- tr_info ("%" PRIu32 " UC %u" , fhss_structure -> platform_functions .fhss_get_timestamp (fhss_structure -> fhss_api ), next_channel );
69
+ tr_info ("%" PRIu32 " UC %u %u " , fhss_structure -> platform_functions .fhss_get_timestamp (fhss_structure -> fhss_api ), next_channel , fhss_structure -> ws -> slot );
69
70
#endif /*FHSS_CHANNEL_DEBUG*/
70
71
fhss_structure -> callbacks .change_channel (fhss_structure -> fhss_api , next_channel );
71
72
}
72
73
73
74
static int fhss_ws_tx_handle_callback (const fhss_api_t * api , bool is_broadcast_addr , uint8_t * destination_address , int frame_type , uint16_t frame_length , uint8_t phy_header_length , uint8_t phy_tail_length )
74
75
{
76
+ (void ) is_broadcast_addr ;
77
+ (void ) frame_type ;
78
+ (void ) frame_length ;
79
+ (void ) phy_header_length ;
80
+ (void ) phy_tail_length ;
81
+ fhss_structure_t * fhss_structure = fhss_get_object_with_api (api );
82
+ if (!fhss_structure ) {
83
+ return -1 ;
84
+ }
85
+ if (fhss_structure -> fhss_state == FHSS_SYNCHRONIZED ) {
86
+ int32_t tx_channel ;
87
+ //TODO: Compute destination slot using neighbour table
88
+ uint16_t destination_slot = fhss_structure -> ws -> slot ;
89
+ if (fhss_structure -> ws -> channel_function == WS_TR51CF ) {
90
+ tx_channel = tr51_get_uc_channel_index (destination_slot , destination_address , fhss_structure -> number_of_channels );
91
+ } else if (fhss_structure -> ws -> channel_function == WS_DH1CF ) {
92
+ tx_channel = dh1cf_get_uc_channel_index (destination_slot , destination_address , fhss_structure -> number_of_channels );
93
+ } else if (fhss_structure -> ws -> channel_function == WS_VENDOR_DEF_CF ) {
94
+
95
+ }
96
+ #ifdef FHSS_CHANNEL_DEBUG
97
+ tr_debug ("TX channel: %u %u" , tx_channel , destination_slot + 1 );
98
+ #endif /*FHSS_CHANNEL_DEBUG*/
99
+ fhss_structure -> callbacks .change_channel (fhss_structure -> fhss_api , tx_channel );
100
+ }
75
101
return 0 ;
76
102
}
77
103
78
104
static bool fhss_ws_check_tx_conditions_callback (const fhss_api_t * api , bool is_broadcast_addr , uint8_t handle , int frame_type , uint16_t frame_length , uint8_t phy_header_length , uint8_t phy_tail_length )
79
105
{
106
+ (void ) api ;
107
+ (void ) is_broadcast_addr ;
108
+ (void ) handle ;
109
+ (void ) frame_type ;
110
+ (void ) frame_length ;
111
+ (void ) phy_header_length ;
112
+ (void ) phy_tail_length ;
80
113
return true;
81
114
}
82
115
0 commit comments