@@ -126,21 +126,25 @@ COMPONENT_INIT {
126
126
srand (time (NULL ));
127
127
128
128
device_t * device = ta_device (STRINGIZE (EP_TARGET ));
129
- device -> op -> get_key (private_key );
130
- device -> op -> get_device_id (device_id );
131
-
129
+ if (device == NULL ) {
130
+ LE_ERROR ("Can not get specific device" );
131
+ } else {
132
+ device -> op -> get_key (private_key );
133
+ device -> op -> get_device_id (device_id );
132
134
#ifdef ENABLE_ENDPOINT_TEST
133
- LE_TEST_INIT ;
134
- LE_TEST_INFO ("=== ENDPOINT TEST BEGIN ===" );
135
- LE_TEST (SC_OK == send_transaction_information (host , port , ssl_seed , value , message , message_fmt , tag , address ,
136
- next_address , private_key , device_id_ptr , iv ));
137
- LE_TEST_EXIT ;
135
+ LE_TEST_INIT ;
136
+ LE_TEST_INFO ("=== ENDPOINT TEST BEGIN ===" );
137
+ LE_TEST (SC_OK == send_transaction_information (host , port , ssl_seed , value , message , message_fmt , tag , address ,
138
+ next_address , private_key , device_id_ptr , iv ));
139
+ LE_TEST_EXIT ;
138
140
#else
139
- while (true) {
140
- status_t ret = send_transaction_information (host , port , ssl_seed , value , message , message_fmt , tag , address ,
141
- next_address , private_key , device_id_ptr , iv );
142
- LE_INFO ("Send transaction information return: %d" , ret );
143
- sleep (10 );
144
- }
141
+ while (true) {
142
+ // TODO: listen input from UART here
143
+ status_t ret = send_transaction_information (host , port , ssl_seed , value , message , message_fmt , tag , address ,
144
+ next_address , private_key , device_id_ptr , iv );
145
+ LE_INFO ("Send transaction information return: %d" , ret );
146
+ sleep (10 );
147
+ }
145
148
#endif
149
+ }
146
150
}
0 commit comments