Skip to content

cloud.smarthq.service.barcode

  • State


    A list of the states this service can be in.

    Go There

  • Commands


    How to change the state of the service.

    Go There

  • Data Types


    All the data types used for this service.

    Go There

Description

Service to model barcode scanner

Example Device Response (Digital Twin API)

Service representing the barcode scanner for refrigerator devices.

{
  "adapterId": "0000000000000000000000000000000000000000",
  "alertTypes": [],
  "createdDateTime": "2022-03-04T12:12:12.123Z",
  "deviceId": "0000000000000000000000000000000000000000000000000000000000000000",
  "deviceType": "cloud.smarthq.device.refrigerator",
  "gatewayId": "0000000000000000000000000000000000000000000000000000000000000000",
  "kind": "device#item",
  "lastPresenceTime": "2022-03-04T12:12:12.123Z",
  "lastSyncTime": "2022-03-04T12:12:12.123Z",
  "presence": "OFFLINE",
  "removable": true,
  "services": [
    {
      "serviceType": "cloud.smarthq.service.barcode",
      "lastSyncTime": "2022-03-04T12:12:12.123Z",
      "domainType": "cloud.smarthq.domain.scanner",
      "supportedCommands": [],
      "state": {
        "resultBarcodeType": "cloud.smarthq.type.barcode.codabar",
        "requestBarcodeType": "cloud.smarthq.type.barcode.qr",
        "resultBarcodeResult": "cloud.smarthq.result.barcode.added",
        "requestMaxVisibleCharacters": 20.0,
        "resultTitle": "Orange Juice 2L",
        "requestBarcode": "A1B2C3D4",
        "resultSequenceNumber": 110.0,
        "requestSequenceNumber": 111.0,
        "resultMaxVisibleCharacters": 15.0
      },
      "serviceId": "0000000000000000000000000000000000000000000000000000000000000000",
      "serviceDeviceType": "cloud.smarthq.device.refrigerator",
      "config": {},
      "lastStateTime": "2022-03-04T12:12:12.123Z"
    }
  ],
  "userId": "000000000000000"
}

State

The following are properties for the device state report as part of the "state" object for each individual service.

Field Name Property Type Required Minimum Maximum
disabled BOOLEAN No
requestBarcode STRING No
requestBarcodeType BARCODE No
requestMaxVisibleCharacters INTEGER No -2147483648 2147483647
requestSequenceNumber INTEGER No -2147483648 2147483647
resultBarcode STRING No
resultBarcodeResult BARCODE_RESULT No
resultBarcodeType BARCODE No
resultMaxVisibleCharacters INTEGER No -2147483648 2147483647
resultSequenceNumber INTEGER No -2147483648 2147483647
resultTitle STRING No

Commands

The following are properties for both the Digital Twin API to send a command to the device as well as the properties passed as part of a command to the gateway to be processed by the device itself.

cloud.smarthq.command.barcode.set

Command to set a new value for the barcode service.

Field Name Property Type Required Minimum Maximum
barcode STRING Yes
barcodeResult BARCODE_RESULT Yes
barcodeType BARCODE Yes
maxVisibleCharacters INTEGER Yes -2147483648 2147483647
sequenceNumber INTEGER Yes -2147483648 2147483647
title STRING Yes

Example Commands

Command to set the barcode.

{
  "command": {
    "maxVisibleCharacters": 15.0,
    "sequenceNumber": 110.0,
    "commandType": "cloud.smarthq.command.barcode.set",
    "barcodeType": "cloud.smarthq.type.barcode.codabar",
    "title": "Orange Juice 2L",
    "barcode": "A1B2C3D4",
    "barcodeResult": "cloud.smarthq.result.barcode.added"
  },
  "deviceId": "00000000000000000000000000000000000000000000000000000000000000",
  "domainType": "cloud.smarthq.domain.scanner",
  "kind": "service#command",
  "serviceDeviceType": "cloud.smarthq.device.refrigerator",
  "serviceType": "cloud.smarthq.service.barcode"
}

Supported Outcomes

Each service has an allow listed set of outcomes that the device may return when asked to execute a command.

Outcome Documentation
cloud.smarthq.outcome.developererror Only used when there is a server side bug
cloud.smarthq.outcome.deviceoffline The device is offline.
cloud.smarthq.outcome.forbidden The request is forbidden due to permissions.
cloud.smarthq.outcome.internalerror The server had an issue processing the request
cloud.smarthq.outcome.missingconfig The service config is missing
cloud.smarthq.outcome.missingstate The service state is missing
cloud.smarthq.outcome.notallowed The command is not allowed.
cloud.smarthq.outcome.notfound The request is forbidden due to permissions.
cloud.smarthq.outcome.notsupported The command is not supported.
cloud.smarthq.outcome.servicedisabled Feature is currently disabled
cloud.smarthq.outcome.success Successful request
cloud.smarthq.outcome.timeout The server experienced timeout waiting for a response from the gateway

Data Types

BOOLEAN

Value must be either true or false.

INTEGER

Value must be an integer. Field specific restrictions such as a minimum and maximum may apply depending on the field.

STRING

Value must be a sequence of characters, inserted between " and " (double quotes). Field specific restrictions such as a regular expression may apply depending on the field.

BARCODE

BARCODE Documentation
cloud.smarthq.type.barcode.aztec 24
cloud.smarthq.type.barcode.codabar 13
cloud.smarthq.type.barcode.code11 15
cloud.smarthq.type.barcode.code128 0
cloud.smarthq.type.barcode.code39 12
cloud.smarthq.type.barcode.code93 14
cloud.smarthq.type.barcode.datamatrix 22
cloud.smarthq.type.barcode.ean13 2
cloud.smarthq.type.barcode.ean8 1
cloud.smarthq.type.barcode.industrial2of5 11
cloud.smarthq.type.barcode.interleaved2of5 7
cloud.smarthq.type.barcode.issb 4
cloud.smarthq.type.barcode.issn 3
cloud.smarthq.type.barcode.itf14 9
cloud.smarthq.type.barcode.itf6 8
cloud.smarthq.type.barcode.matrix2of5 10
cloud.smarthq.type.barcode.maxi 25
cloud.smarthq.type.barcode.msiplessey 16
cloud.smarthq.type.barcode.pdf417 21
cloud.smarthq.type.barcode.pdf417.micro 26
cloud.smarthq.type.barcode.qr 23
cloud.smarthq.type.barcode.qr.micro 27
cloud.smarthq.type.barcode.rss14 17
cloud.smarthq.type.barcode.rss14.expanded 19
cloud.smarthq.type.barcode.rss14.limited 18
cloud.smarthq.type.barcode.rss14.stacked 20
cloud.smarthq.type.barcode.unknown -1
cloud.smarthq.type.barcode.upca 6
cloud.smarthq.type.barcode.upce 5

BARCODE_RESULT

BARCODE_RESULT Documentation
cloud.smarthq.result.barcode.added 1
cloud.smarthq.result.barcode.error.connection 4
cloud.smarthq.result.barcode.error.timeout 5
cloud.smarthq.result.barcode.rejected 3
cloud.smarthq.result.barcode.unknown 0
cloud.smarthq.result.barcode.valid 2