UNPKG

@iotize/tap

Version:

IoTize Device client for Javascript

532 lines (519 loc) 13.5 kB
import { AbstractService, extendServiceContainer } from '@iotize/tap'; import { TapRequestFrame } from '@iotize/tap/client/api'; import { createEnumConverter, createEnumArrayConverter, converters } from '@iotize/tap/service/core'; /* tslint:disable */ /** * This file was automatically generated by json-schema-to-typescript. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run json-schema-to-typescript to regenerate this file. */ var AvailablePowerSource; (function (AvailablePowerSource) { AvailablePowerSource[AvailablePowerSource["DC_POWER"] = 1] = "DC_POWER"; AvailablePowerSource[AvailablePowerSource["S3P"] = 16] = "S3P"; AvailablePowerSource[AvailablePowerSource["AC_EXTERNAL_POWER"] = 32] = "AC_EXTERNAL_POWER"; })(AvailablePowerSource || (AvailablePowerSource = {})); /** * Generated file. Do not edit */ const availablePowerSource = createEnumConverter(AvailablePowerSource, 1); const availablePowerSourceArray = createEnumArrayConverter(AvailablePowerSource, 1); var serviceConverters = /*#__PURE__*/Object.freeze({ __proto__: null, availablePowerSource: availablePowerSource, availablePowerSourceArray: availablePowerSourceArray }); /** * Generated file. Do not edit */ const allConverters = Object.assign(Object.assign({}, converters), serviceConverters); const SERVICE_CALLS = { getManufacturer: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/manufacturer', path: '/3//0', responseBodyDecoder: allConverters.ascii, }, getFirmwareFlavor: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/firmware-flavor', path: '/3//1', responseBodyDecoder: allConverters.ascii, }, getSerialNumber: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/serial-number', path: '/3//2', responseBodyDecoder: allConverters.ascii, }, getFirmwareVersion: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/firmware-version', path: '/3//3', responseBodyDecoder: allConverters.ascii, }, reboot: { method: TapRequestFrame.MethodType.POST, pathAlias: '/device/reboot', path: '/3//4', }, factoryReset: { method: TapRequestFrame.MethodType.POST, pathAlias: '/device/factory-reset', path: '/3//5', }, getAvailablePowerSource: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/available-power-source', path: '/3//6', responseBodyDecoder: allConverters.availablePowerSource, }, getPowerSourceVoltage: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/power-source-voltage', path: '/3//7', responseBodyDecoder: allConverters.uint32, }, getMemoryFree: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/memory-free', path: '/3//10', responseBodyDecoder: allConverters.uint32, }, getLastErrorCode: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/last-error-code', path: '/3//11', responseBodyDecoder: allConverters.uint32, }, postLastErrorCode: { method: TapRequestFrame.MethodType.POST, pathAlias: '/device/last-error-code', path: '/3//11', bodyEncoder: allConverters.uint32, }, resetLastErrorCode: { method: TapRequestFrame.MethodType.POST, pathAlias: '/device/reset-last-error-code', path: '/3//12', }, getCurrentTime: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/current-time', path: '/3//13', responseBodyDecoder: allConverters.uint32, }, putCurrentTime: { method: TapRequestFrame.MethodType.PUT, pathAlias: '/device/current-time', path: '/3//13', bodyEncoder: allConverters.uint32, }, getInternalStatus: { method: TapRequestFrame.MethodType.GET, pathAlias: '/device/internal-status', path: '/3//15', responseBodyDecoder: allConverters.ascii, }, }; class DeviceService extends AbstractService { constructor() { super(...arguments); this.resources = SERVICE_CALLS; } /** * Get manufacturer name * * LWM2M path: /3//0 * * @tapVersion(">=1.0") * @return */ getManufacturer() { return this.serviceCallRunner.execute(this.getManufacturerCall()); } /** * * * LWM2M path: /3//0 * * @tapVersion(">=1.0") * @return call options */ getManufacturerCall() { const callOptions = Object.assign({}, this.resources.getManufacturer); return callOptions; } /** * Get device firmware flavor name * * LWM2M path: /3//1 * * @tapVersion(">=1.0") * @return */ getFirmwareFlavor() { return this.serviceCallRunner.execute(this.getFirmwareFlavorCall()); } /** * * * LWM2M path: /3//1 * * @tapVersion(">=1.0") * @return call options */ getFirmwareFlavorCall() { const callOptions = Object.assign({}, this.resources.getFirmwareFlavor); return callOptions; } /** * Get device serial number * * LWM2M path: /3//2 * * @tapVersion(">=1.0") * @return */ getSerialNumber() { return this.serviceCallRunner.execute(this.getSerialNumberCall()); } /** * * * LWM2M path: /3//2 * * @tapVersion(">=1.0") * @return call options */ getSerialNumberCall() { const callOptions = Object.assign({}, this.resources.getSerialNumber); return callOptions; } /** * Get device firmware version * * LWM2M path: /3//3 * * @tapVersion(">=1.0") * @return */ getFirmwareVersion() { return this.serviceCallRunner.execute(this.getFirmwareVersionCall()); } /** * * * LWM2M path: /3//3 * * @tapVersion(">=1.0") * @return call options */ getFirmwareVersionCall() { const callOptions = Object.assign({}, this.resources.getFirmwareVersion); return callOptions; } /** * Reboot Tap device * * LWM2M path: /3//4 * * @tapVersion(">=1.0") * @return */ reboot() { return this.serviceCallRunner.execute(this.rebootCall()); } /** * * * LWM2M path: /3//4 * * @tapVersion(">=1.0") * @return call options */ rebootCall() { const callOptions = Object.assign({}, this.resources.reboot); return callOptions; } /** * Factory reset * * LWM2M path: /3//5 * * @tapVersion(">=1.0") * @return */ factoryReset() { return this.serviceCallRunner.execute(this.factoryResetCall()); } /** * * * LWM2M path: /3//5 * * @tapVersion(">=1.0") * @return call options */ factoryResetCall() { const callOptions = Object.assign({}, this.resources.factoryReset); return callOptions; } /** * Get available power sources * * LWM2M path: /3//6 * * @tapVersion(">=1.0") * @return */ getAvailablePowerSource() { return this.serviceCallRunner.execute(this.getAvailablePowerSourceCall()); } /** * * * LWM2M path: /3//6 * * @tapVersion(">=1.0") * @return call options */ getAvailablePowerSourceCall() { const callOptions = Object.assign({}, this.resources.getAvailablePowerSource); return callOptions; } /** * Get power source voltage * * LWM2M path: /3//7 * * @tapVersion(">=1.0") * @return */ getPowerSourceVoltage() { return this.serviceCallRunner.execute(this.getPowerSourceVoltageCall()); } /** * * * LWM2M path: /3//7 * * @tapVersion(">=1.0") * @return call options */ getPowerSourceVoltageCall() { const callOptions = Object.assign({}, this.resources.getPowerSourceVoltage); return callOptions; } /** * Get device memory free * * LWM2M path: /3//10 * * @tapVersion(">=1.0") * @return */ getMemoryFree() { return this.serviceCallRunner.execute(this.getMemoryFreeCall()); } /** * * * LWM2M path: /3//10 * * @tapVersion(">=1.0") * @return call options */ getMemoryFreeCall() { const callOptions = Object.assign({}, this.resources.getMemoryFree); return callOptions; } /** * Get device last error code * * LWM2M path: /3//11 * * @tapVersion(">=1.0") * @return */ getLastErrorCode() { return this.serviceCallRunner.execute(this.getLastErrorCodeCall()); } /** * * * LWM2M path: /3//11 * * @tapVersion(">=1.0") * @return call options */ getLastErrorCodeCall() { const callOptions = Object.assign({}, this.resources.getLastErrorCode); return callOptions; } /** * Set device last error code * * LWM2M path: /3//11 * * @tapVersion(">=1.0") * @param errorcode input * @return */ postLastErrorCode( /* * */ errorcode) { return this.serviceCallRunner.execute(this.postLastErrorCodeCall(errorcode)); } /** * * * LWM2M path: /3//11 * * @tapVersion(">=1.0") * @param errorcode input * @return call options */ postLastErrorCodeCall( /* * */ errorcode) { const callOptions = Object.assign({}, this.resources.postLastErrorCode); callOptions.body = errorcode; return callOptions; } /** * Reset device last error code * * LWM2M path: /3//12 * * @tapVersion(">=1.0") * @return */ resetLastErrorCode() { return this.serviceCallRunner.execute(this.resetLastErrorCodeCall()); } /** * * * LWM2M path: /3//12 * * @tapVersion(">=1.0") * @return call options */ resetLastErrorCodeCall() { const callOptions = Object.assign({}, this.resources.resetLastErrorCode); return callOptions; } /** * Get device current time * * LWM2M path: /3//13 * * @tapVersion(">=1.0") * @return */ getCurrentTime() { return this.serviceCallRunner.execute(this.getCurrentTimeCall()); } /** * * * LWM2M path: /3//13 * * @tapVersion(">=1.0") * @return call options */ getCurrentTimeCall() { const callOptions = Object.assign({}, this.resources.getCurrentTime); return callOptions; } /** * Set device current time * * LWM2M path: /3//13 * * @tapVersion(">=1.0") * @param time input * @return */ putCurrentTime( /* * */ time) { return this.serviceCallRunner.execute(this.putCurrentTimeCall(time)); } /** * * * LWM2M path: /3//13 * * @tapVersion(">=1.0") * @param time input * @return call options */ putCurrentTimeCall( /* * */ time) { const callOptions = Object.assign({}, this.resources.putCurrentTime); callOptions.body = time; return callOptions; } /** * Get device internal status * * LWM2M path: /3//15 * * @tapVersion(">=2.11") * @return */ getInternalStatus() { return this.serviceCallRunner.execute(this.getInternalStatusCall()); } /** * * * LWM2M path: /3//15 * * @tapVersion(">=2.11") * @return call options */ getInternalStatusCall() { const callOptions = Object.assign({}, this.resources.getInternalStatus); return callOptions; } } const _TAP_SERVICE_EXTENSION_DEVICE_ = extendServiceContainer('device', DeviceService); /** * Generated file. Do not edit */ /** * Generated file. Do not edit */ /** * Generated file. Do not edit */ const ResourceMetaData = { '/device/current-time': { put: { minApiVersion: 1.0, configModeRequired: true, schema: { type: 'integer', format: 'uint32', }, }, }, }; // import './lib/custom/extension'; /** * Generated bundle index. Do not edit. */ export { AvailablePowerSource, SERVICE_CALLS as DEVICE_SERVICE_CALLS, ResourceMetaData as DeviceResourceMetaData, DeviceService, _TAP_SERVICE_EXTENSION_DEVICE_, serviceConverters as deviceConverters }; //# sourceMappingURL=iotize-tap-service-impl-device.js.map