nRF Cloud - edit Device Information

How to change Device Information in nRF Cloud? Where do I find the code setting this info? Where is "App Name" and "App Version" defined? 

The application is nrf_cloud_multi_service, but I am modifying it, and want to change name.

  • Posting the code here, so it could help someone facing the same issue. 

    int nrf_cloud_update_device_status(void){
    
    	int ret;
    	
    	NRF_CLOUD_OBJ_JSON_DEFINE(reported_obj);
    	NRF_CLOUD_OBJ_JSON_DEFINE(device_obj);
    	NRF_CLOUD_OBJ_JSON_DEFINE(info_obj);
    	
    
    	nrf_cloud_obj_msg_init(&reported_obj, "DEVICE",NRF_CLOUD_JSON_MSG_TYPE_VAL_DATA);
    
    	if (nrf_cloud_obj_init(&device_obj) || nrf_cloud_obj_init(&info_obj)) {
    
    		nrf_cloud_obj_free(&reported_obj);
    		nrf_cloud_obj_free(&device_obj);
    		nrf_cloud_obj_free(&info_obj);
    
    		return -ENOMEM;
    	}
    
    	ret = nrf_cloud_obj_num_add(&info_obj,"batteryVoltage" , 3, false);
    	ret = nrf_cloud_obj_str_add(&info_obj,"hwVer","v1.0.1",false);
    
    	ret = nrf_cloud_obj_object_add(&device_obj, NRF_CLOUD_DEVICE_JSON_KEY_DEV_INF, &info_obj, false);
    	if (ret) {
    
    		nrf_cloud_obj_free(&reported_obj);
    		nrf_cloud_obj_free(&device_obj);
    		nrf_cloud_obj_free(&info_obj);
    
    		return -ENOMEM;
    	}
    
    	ret = nrf_cloud_obj_object_add(&reported_obj, NRF_CLOUD_JSON_DATA_KEY, &device_obj, false);
    	if (ret) {
    
    		nrf_cloud_obj_free(&reported_obj);
    		nrf_cloud_obj_free(&device_obj);
    		nrf_cloud_obj_free(&info_obj);
    
    		return -ENOMEM;
    	}
    
    	/* Send the sensor sample container object as a device message. */
    	return send_device_message(&reported_obj);
    }

    best regards,

    Akshay

Related