@@ -410,32 +410,40 @@ IARM_Result_t ctrlm_rcp_ipc_iarm_thunder_t::get_net_status(void *arg)
410410 json_t *status = json_object ();
411411 json_t *net_type_supported = json_array ();
412412 json_t *remote_array = json_array ();
413+
413414 std::map<ctrlm_network_id_t , ctrlm_rcp_ipc_net_status_t > status_map = params->get_reply ();
414415 std::vector<ctrlm_rcp_ipc_controller_status_t > remotes;
415- std::string ir_prog_state, rf_pair_state;
416+
417+ ctrlm_network_type_t type = CTRLM_NETWORK_TYPE_INVALID;
418+ ctrlm_ir_state_t ir_prog_state = CTRLM_IR_STATE_UNKNOWN;
419+ ctrlm_rf_pair_state_t rf_pair_state = CTRLM_RF_PAIR_STATE_UNKNOWN;
416420 int err = 0 ;
417421
418422 for (auto const &it : ctrlm_network_types_get ()) {
419423 err |= json_array_append_new (net_type_supported, json_integer (it));
420424 }
421-
422425 for (auto &it : status_map) {
423- if (it.second .get_type () == CTRLM_NETWORK_TYPE_BLUETOOTH_LE) {
424- ir_prog_state = it.second .get_ir_prog_state ();
425- }
426- rf_pair_state = it.second .get_rf_pair_state ();
427426 it.second .get_controller_status_list (remotes);
428427 }
429-
430428 for (auto remote : remotes) {
431429 err |= json_array_append_new (remote_array, remote.to_json ());
432430 }
431+ // For now default to RF4CE network reporting if available
432+ for (auto &it : status_map) {
433+ ir_prog_state = it.second .get_ir_prog_state ();
434+ rf_pair_state = it.second .get_rf_pair_state ();
435+ type = it.second .get_type ();
436+
437+ if (type == CTRLM_NETWORK_TYPE_RF4CE) {
438+ break ;
439+ }
440+ }
433441
434442 err |= json_object_set_new_nocheck (status, REMOTE_DATA, remote_array);
435443 err |= json_object_set_new_nocheck (status, NET_TYPES_SUPPORTED, net_type_supported);
436- err |= json_object_set_new_nocheck (status, NET_TYPE, json_integer (0 )); // TODO
437- err |= json_object_set_new_nocheck (status, PAIRING_STATE , json_string (ir_prog_state. c_str ( ))); // TODO
438- err |= json_object_set_new_nocheck (status, IR_PROG_STATE , json_string (rf_pair_state. c_str ( )));
444+ err |= json_object_set_new_nocheck (status, NET_TYPE, json_integer (type ));
445+ err |= json_object_set_new_nocheck (status, IR_PROG_STATE , json_string (ctrlm_ir_state_str (ir_prog_state )));
446+ err |= json_object_set_new_nocheck (status, PAIRING_STATE , json_string (ctrlm_rf_pair_state_str (rf_pair_state )));
439447
440448 err |= json_object_set_new_nocheck (ret, STATUS, status);
441449 err |= json_object_set_new_nocheck (ret, SUCCESS, json_boolean (params->get_result ()));
0 commit comments