UNPKG

@iotize/tap

Version:

IoTize Device client for Javascript

525 lines (513 loc) 12.2 kB
import { AbstractService, extendServiceContainer } from '@iotize/tap'; import { TapRequestFrame } from '@iotize/tap/client/api'; import { converters } from '@iotize/tap/service/core'; // JvmService.prototype.clearCode = function ( // this: JvmService // ): Promise<TapResponse<void>> { // return this.serviceCallRunner.execute(this.clearCodeCall()); // }; // JvmService.prototype.clearCodeCall = function ( // this: JvmService // ) { // return { // path: '/1024//74', // pathAlias: '/jvm/code', // method: TapRequestFrame.MethodType.PUT, // body: Uint8Array.from([0]) // } as ServiceCallType<Uint8Array, void>; // }; /** * Generated file. Do not edit */ var serviceConverters = /*#__PURE__*/Object.freeze({ __proto__: null }); /** * Generated file. Do not edit */ const allConverters = Object.assign(Object.assign({}, converters), serviceConverters); const SERVICE_CALLS = { getCodeSize: { method: TapRequestFrame.MethodType.GET, pathAlias: '/jvm/code-size', path: '/1024//73', responseBodyDecoder: allConverters.uint32, }, putCodeSize: { method: TapRequestFrame.MethodType.PUT, pathAlias: '/jvm/code-size', path: '/1024//73', bodyEncoder: allConverters.uint32, }, appendCode: { method: TapRequestFrame.MethodType.PUT, pathAlias: '/jvm/code', append: true, path: '/1024//74', }, clearCode: { method: TapRequestFrame.MethodType.PUT, pathAlias: '/jvm/clear-code', path: '/1024//74', }, getProfileId: { method: TapRequestFrame.MethodType.GET, pathAlias: '/jvm/profile-id', path: '/1024//66', responseBodyDecoder: allConverters.uint16, }, putProfileId: { method: TapRequestFrame.MethodType.PUT, pathAlias: '/jvm/profile-id', path: '/1024//66', bodyEncoder: allConverters.uint16, }, getLogAndClear: { method: TapRequestFrame.MethodType.GET, pathAlias: '/jvm/log-and-clear', path: '/1024//120', responseBodyDecoder: allConverters.ascii, }, clearLog: { method: TapRequestFrame.MethodType.PUT, pathAlias: '/jvm/log-and-clear', path: '/1024//120', }, getLog: { method: TapRequestFrame.MethodType.GET, pathAlias: '/jvm/log', path: '/1024//121', responseBodyDecoder: allConverters.ascii, }, putLog: { method: TapRequestFrame.MethodType.PUT, pathAlias: '/jvm/log', path: '/1024//121', bodyEncoder: allConverters.ascii, }, getErrorCode: { method: TapRequestFrame.MethodType.GET, pathAlias: '/jvm/error-code', path: '/3//14', responseBodyDecoder: allConverters.uint32, }, postErrorCode: { method: TapRequestFrame.MethodType.POST, pathAlias: '/jvm/error-code', path: '/3//14', bodyEncoder: allConverters.uint32, }, }; class JvmService extends AbstractService { constructor() { super(...arguments); this.resources = SERVICE_CALLS; } /** * Get JVM reserved code size * * LWM2M path: /1024//73 * * @tapVersion(">=1.90") * @return */ getCodeSize() { return this.serviceCallRunner.execute(this.getCodeSizeCall()); } /** * * * LWM2M path: /1024//73 * * @tapVersion(">=1.90") * @return call options */ getCodeSizeCall() { const callOptions = Object.assign({}, this.resources.getCodeSize); return callOptions; } /** * Write JVM reserved code size * * LWM2M path: /1024//73 * * @tapVersion(">=1.90") * @param value input * @return */ putCodeSize( /* * */ value) { return this.serviceCallRunner.execute(this.putCodeSizeCall(value)); } /** * * * LWM2M path: /1024//73 * * @tapVersion(">=1.90") * @param value input * @return call options */ putCodeSizeCall( /* * */ value) { const callOptions = Object.assign({}, this.resources.putCodeSize); callOptions.body = value; return callOptions; } /** * Append JVM code. If body length is 0, it will clear code stored in Tap. * * LWM2M path: /1024//74 * * @tapVersion(">=1.90") * @param value input * @return */ appendCode( /* * */ value) { return this.serviceCallRunner.execute(this.appendCodeCall(value)); } appendCodeAppendCalls( /* * */ value, chunkSize) { return this.serviceCallRunner.createAppendCalls(this.appendCodeCall(value), chunkSize); } /** * * * LWM2M path: /1024//74 * * @tapVersion(">=1.90") * @param value input * @return call options */ appendCodeCall( /* * */ value) { const callOptions = Object.assign({}, this.resources.appendCode); callOptions.body = value; return callOptions; } /** * Clear code stored in Tap. * * LWM2M path: /1024//74 * * @tapVersion(">=1.90") * @return */ clearCode() { return this.serviceCallRunner.execute(this.clearCodeCall()); } /** * * * LWM2M path: /1024//74 * * @tapVersion(">=1.90") * @return call options */ clearCodeCall() { const callOptions = Object.assign({}, this.resources.clearCode); return callOptions; } /** * Get user id that gives rights to the JVM code * * LWM2M path: /1024//66 * * @tapVersion(">=1.0") * @return */ getProfileId() { return this.serviceCallRunner.execute(this.getProfileIdCall()); } /** * * * LWM2M path: /1024//66 * * @tapVersion(">=1.0") * @return call options */ getProfileIdCall() { const callOptions = Object.assign({}, this.resources.getProfileId); return callOptions; } /** * Write user id that gives right to the JVM code * * LWM2M path: /1024//66 * * @tapVersion(">=1.0") * @param key input * @return */ putProfileId( /* * */ key) { return this.serviceCallRunner.execute(this.putProfileIdCall(key)); } /** * * * LWM2M path: /1024//66 * * @tapVersion(">=1.0") * @param key input * @return call options */ putProfileIdCall( /* * */ key) { const callOptions = Object.assign({}, this.resources.putProfileId); callOptions.body = key; return callOptions; } /** * Read and then clear JVM log * * LWM2M path: /1024//120 * * @tapVersion(">=2.11") * @return */ getLogAndClear() { return this.serviceCallRunner.execute(this.getLogAndClearCall()); } /** * * * LWM2M path: /1024//120 * * @tapVersion(">=2.11") * @return call options */ getLogAndClearCall() { const callOptions = Object.assign({}, this.resources.getLogAndClear); return callOptions; } /** * Clear JVM log * * LWM2M path: /1024//120 * * @tapVersion(">=2.11") * @return */ clearLog() { return this.serviceCallRunner.execute(this.clearLogCall()); } /** * * * LWM2M path: /1024//120 * * @tapVersion(">=2.11") * @return call options */ clearLogCall() { const callOptions = Object.assign({}, this.resources.clearLog); return callOptions; } /** * Read JVM log * * LWM2M path: /1024//121 * * @tapVersion(">=2.11") * @return */ getLog() { return this.serviceCallRunner.execute(this.getLogCall()); } /** * * * LWM2M path: /1024//121 * * @tapVersion(">=2.11") * @return call options */ getLogCall() { const callOptions = Object.assign({}, this.resources.getLog); return callOptions; } /** * Write JVM log * * LWM2M path: /1024//121 * * @tapVersion(">=2.11") * @param value input * @return */ putLog( /* * */ value) { return this.serviceCallRunner.execute(this.putLogCall(value)); } /** * * * LWM2M path: /1024//121 * * @tapVersion(">=2.11") * @param value input * @return call options */ putLogCall( /* * */ value) { const callOptions = Object.assign({}, this.resources.putLog); callOptions.body = value; return callOptions; } /** * Get jvm last error code * * LWM2M path: /3//14 * * @tapVersion(">=2.11") * @return */ getErrorCode() { return this.serviceCallRunner.execute(this.getErrorCodeCall()); } /** * * * LWM2M path: /3//14 * * @tapVersion(">=2.11") * @return call options */ getErrorCodeCall() { const callOptions = Object.assign({}, this.resources.getErrorCode); return callOptions; } /** * Set jvm last error code * * LWM2M path: /3//14 * * @tapVersion(">=2.11") * @param errorCode input * @return */ postErrorCode( /* * */ errorCode) { return this.serviceCallRunner.execute(this.postErrorCodeCall(errorCode)); } /** * * * LWM2M path: /3//14 * * @tapVersion(">=2.11") * @param errorCode input * @return call options */ postErrorCodeCall( /* * */ errorCode) { const callOptions = Object.assign({}, this.resources.postErrorCode); callOptions.body = errorCode; return callOptions; } } const _TAP_SERVICE_EXTENSION_JVM_ = extendServiceContainer('jvm', JvmService); /** * Generated file. Do not edit */ /** * Generated file. Do not edit */ /** * Generated file. Do not edit */ const ResourceMetaData = { '/jvm/code-size': { put: { minApiVersion: 1.9, configModeRequired: true, schema: { type: 'integer', format: 'uint32', }, }, }, '/jvm/code': { put: { minApiVersion: 1.9, configModeRequired: true, schema: { $ref: './definitions.yaml#/Bytes', }, }, }, '/jvm/clear-code': { put: { minApiVersion: 1.9, configModeRequired: true, schema: undefined, }, }, '/jvm/profile-id': { put: { minApiVersion: 1.0, configModeRequired: false, schema: { type: 'integer', format: 'uint16', }, }, }, '/jvm/log-and-clear': { put: { minApiVersion: 2.11, configModeRequired: true, schema: undefined, }, }, '/jvm/log': { put: { minApiVersion: 2.11, configModeRequired: true, schema: { type: 'string', }, }, }, }; /** * Generated bundle index. Do not edit. */ export { SERVICE_CALLS as JVM_SERVICE_CALLS, ResourceMetaData as JvmResourceMetaData, JvmService, _TAP_SERVICE_EXTENSION_JVM_, serviceConverters as jvmConverters }; //# sourceMappingURL=iotize-tap-service-impl-jvm.js.map