bool M2MLWClient::create_static_resource_instance_int(const char *name, int32_t value, bool multiple_instance, uint16_t object_instance, uint16_t resource_instance) { bool success = false; String name_string; String value_string; if(name) { name_string += name; } char value_buffer[20]; sprintf(value_buffer,"%ld",value); value_string += value_buffer; if(_object) { M2MObjectInstance *inst = _object->object_instance(object_instance); if(inst) { if(inst->create_static_resource_instance(name,"resource", M2MResourceInstance::INTEGER, (const uint8_t*)value_string.c_str(), value_string.size(), resource_instance) != NULL) { success = true; } } } return success; }
bool M2MLWClient::create_static_resource_instance_string(const char *name, const char *value, bool multiple_instance, uint16_t object_instance, uint16_t resource_instance) { bool success = false; String name_string; if(name) { name_string += name; } String value_string; if(value) { value_string += value; } if(_object) { M2MObjectInstance *inst = _object->object_instance(object_instance); if(inst) { if(inst->create_static_resource_instance(name,"resource", M2MResourceInstance::STRING, (const uint8_t*)value_string.c_str(), value_string.size(), resource_instance) != NULL) { success = true; } } } return success; }