Skip to content

DeviceService

Method LWM2M request Description
factoryReset POST /device/factory-reset Factory reset
getAvailablePowerSource GET /device/available-power-source Get available power sources
getCurrentTime GET /device/current-time Get device current time
getFirmwareVersion GET /device/firmware-version Get device firmware version
getLastErrorCode GET /device/last-error-code Get device last error code
getManufacturer GET /device/manufacturer Get manufacturer name
getMemoryFree GET /device/memory-free Get device memory free
getModelName GET /device/model-name Get device model name
getPowerSourceVoltage GET /device/power-source-voltage Get power source voltage
getPublicPassword GET /device/public-password Get public password
getSerialNumber GET /device/serial-number Get device serial number
postLastErrorCode POST /device/last-error-code ???
putCurrentTime PUT /device/current-time Set device current time
reboot POST /device/reboot Reboot device
resetLastErrorCode POST /device/reset-last-error-code Reset device last error code

factoryReset

factoryReset()

Factory reset

Example

let myService = new DeviceService();

try{
    let call = myService.factoryReset();
    let value = (await call).body();
    console.log(`factoryReset: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<Void> call = myService.factoryReset();
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#factoryReset");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

No authorization required

getAvailablePowerSource

AvailablePowerSource getAvailablePowerSource()

Get available power sources

Example

let myService = new DeviceService();

try{
    let call = myService.getAvailablePowerSource();
    let value = (await call).body();
    console.log(`getAvailablePowerSource: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<AvailablePowerSource> call = myService.getAvailablePowerSource();
    Response<AvailablePowerSource> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getAvailablePowerSource");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

AvailablePowerSource

Authorization

No authorization required

getCurrentTime

String getCurrentTime()

Get device current time

Example

let myService = new DeviceService();

try{
    let call = myService.getCurrentTime();
    let value = (await call).body();
    console.log(`getCurrentTime: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<String> call = myService.getCurrentTime();
    Response<String> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getCurrentTime");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

String

Authorization

No authorization required

getFirmwareVersion

String getFirmwareVersion()

Get device firmware version

Example

let myService = new DeviceService();

try{
    let call = myService.getFirmwareVersion();
    let value = (await call).body();
    console.log(`getFirmwareVersion: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<String> call = myService.getFirmwareVersion();
    Response<String> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getFirmwareVersion");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

String

Authorization

No authorization required

getLastErrorCode

Integer getLastErrorCode()

Get device last error code

Example

let myService = new DeviceService();

try{
    let call = myService.getLastErrorCode();
    let value = (await call).body();
    console.log(`getLastErrorCode: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<Integer> call = myService.getLastErrorCode();
    Response<Integer> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getLastErrorCode");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

Integer

Authorization

No authorization required

getManufacturer

String getManufacturer()

Get manufacturer name

Example

let myService = new DeviceService();

try{
    let call = myService.getManufacturer();
    let value = (await call).body();
    console.log(`getManufacturer: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<String> call = myService.getManufacturer();
    Response<String> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getManufacturer");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

String

Authorization

No authorization required

getMemoryFree

Integer getMemoryFree()

Get device memory free

In bytes

Example

let myService = new DeviceService();

try{
    let call = myService.getMemoryFree();
    let value = (await call).body();
    console.log(`getMemoryFree: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<Integer> call = myService.getMemoryFree();
    Response<Integer> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getMemoryFree");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

Integer

Authorization

No authorization required

getModelName

String getModelName()

Get device model name

Example

let myService = new DeviceService();

try{
    let call = myService.getModelName();
    let value = (await call).body();
    console.log(`getModelName: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<String> call = myService.getModelName();
    Response<String> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getModelName");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

String

Authorization

No authorization required

getPowerSourceVoltage

Integer getPowerSourceVoltage()

Get power source voltage

Example

let myService = new DeviceService();

try{
    let call = myService.getPowerSourceVoltage();
    let value = (await call).body();
    console.log(`getPowerSourceVoltage: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<Integer> call = myService.getPowerSourceVoltage();
    Response<Integer> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getPowerSourceVoltage");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

Integer

Authorization

No authorization required

getPublicPassword

String getPublicPassword()

Get public password

Password pour l'enregistrement. Egalement valeur par défaut des password Cloud et MQTTRelay

Example

let myService = new DeviceService();

try{
    let call = myService.getPublicPassword();
    let value = (await call).body();
    console.log(`getPublicPassword: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<String> call = myService.getPublicPassword();
    Response<String> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getPublicPassword");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

String

Authorization

No authorization required

getSerialNumber

String getSerialNumber()

Get device serial number

Example

let myService = new DeviceService();

try{
    let call = myService.getSerialNumber();
    let value = (await call).body();
    console.log(`getSerialNumber: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<String> call = myService.getSerialNumber();
    Response<String> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#getSerialNumber");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

String

Authorization

No authorization required

postLastErrorCode

postLastErrorCode()

???

Example

let myService = new DeviceService();

try{
    let call = myService.postLastErrorCode();
    let value = (await call).body();
    console.log(`postLastErrorCode: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<Void> call = myService.postLastErrorCode();
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#postLastErrorCode");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

No authorization required

putCurrentTime

putCurrentTime()

Set device current time

Example

let myService = new DeviceService();

try{
    let call = myService.putCurrentTime();
    let value = (await call).body();
    console.log(`putCurrentTime: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<Void> call = myService.putCurrentTime();
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#putCurrentTime");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

No authorization required

reboot

reboot()

Reboot device

Example

let myService = new DeviceService();

try{
    let call = myService.reboot();
    let value = (await call).body();
    console.log(`reboot: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<Void> call = myService.reboot();
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#reboot");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

No authorization required

resetLastErrorCode

resetLastErrorCode()

Reset device last error code

Example

let myService = new DeviceService();

try{
    let call = myService.resetLastErrorCode();
    let value = (await call).body();
    console.log(`resetLastErrorCode: ${value}`);
}
catch (ex){
    // No response from device / response error (ie: device is not connected or request timeout)
    console.error(ex);
}
import com.iotize.android.device.device.api.service.definition.DeviceService;

ServiceFactory serviceFactory = ...;
DeviceService myService = serviceFactory.create(DeviceService.class);


try {
    Call<Void> call = myService.resetLastErrorCode();
    Response<Void> response = call.execute();
    if (response.isSuccessful()){
        System.out.println(response.body());
    }
    else{
        System.out.println(DeviceResponseError.createErrorMessage(response));
    }
} catch (ApiException e) {
    System.err.println("Exception when calling DeviceService#resetLastErrorCode");
    e.printStackTrace();
}

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

No authorization required