data_str = msg_param->get_string_parameter(RSP__GET_LATEST_DATA__VALUE, err_flg);
data = Data::parse_string(data_str);
ret_val = new DataRange(data);
- log_info("date: %s\n", data->get_date().to_string().c_str());
log_debug("latest data\n");
data->printout();
key << RSP__DEVICE_LIST__ID << ii;
id = msg_param->get_string_parameter(key.str(), err_flg);
if (*err_flg != PLP_OK) {
- log_error("Failed to parse device id\n");
+ log_error("Failed to parse device id.\n");
break;
}
key << RSP__DEVICE_LIST__NAME << ii;
name = msg_param->get_string_parameter(key.str(), err_flg);
if (*err_flg != PLP_OK) {
- log_error("Failed to parse device name\n");
+ log_error("Failed to parse name for the device: %s\n", id.c_str());
break;
}
key << RSP__DEVICE_LIST__TYPE << ii;
type = msg_param->get_string_parameter(key.str(), err_flg);
if (*err_flg != PLP_OK) {
- log_error("Failed to parse device type\n");
+ log_error("Failed to parse type for the device: %s\n", id.c_str());
break;
}
key << RSP__DEVICE_LIST__LF_STATE << ii;
state_i = msg_param->get_int_parameter(key.str(), err_flg);
if (*err_flg != PLP_OK) {
- log_error("Failed to parse device's life cycle state\n");
+ log_error("Failed to parse life cycle state for the device: %s\n", id.c_str());
break;
}
state = (EnumDeviceLifeCycleStatus)state_i;
key.str("");
key << RSP__DEVICE_LIST__DATA << ii;
datastr = msg_param->get_string_parameter(key.str(), err_flg);
- if (*err_flg != PLP_OK) {
- log_error("Failed to parse device's data\n");
- break;
+ if (*err_flg == PLP_OK) {
+ data = Data::parse_string(datastr);
+ if (data == NULL) {
+ log_error("Failed to parse data items for the device: %s\n", id.c_str());
+ *err_flg = PLP_ERR;
+ break;
+ }
}
-
- data = Data::parse_string(datastr);
- if (data == NULL) {
- log_error("Failed to parse device's data items.\n");
- *err_flg = PLP_ERR;
- break;
+ else {
+ log_error("No data available for the device: %s\n", id.c_str());
+ data = new Data(0);
}
dev = new DeviceData(id, type, name, state, data);
ret_val->push_back(dev);