クラウド上で設定した TSL モデルおよびサブデバイス接続チャネル設定の拡張設定情報をゲートウェイデバイスに送信します。

  • トピック : /sys/{productKey}/{deviceName}/thing/model/config/push

リクエストメッセージ

{
  "id": 123,
  "version": "1.0",
  "method": "thing.model.config.push",
  "data": {
    "digest":"",
    "digestMethod":"",
    "url": ""
  }
}

パラメーターの説明

パラメーター データタイプ 説明
id 文字列 メッセージ ID
version 文字列 プロトコルのバージョン番号 デフォルト値 : 1.0
method 文字列 メソッドは thing.model.config.push です。
data オブジェクト データ
digest 文字列 url から取得したデータの整合性を検証するために使用される署名
digestMethod 文字列 署名メソッドです。 デフォルトのメソッドは sha256 です。
url 文字列 OSS から取得するデータの URL

レスポンスメッセージ

{
  "id":123,
  "code":200,
  "message":"success",
  "data":{
    "digest":"",
    "digestMethod":"",
    "url":""
  }
}

url データ

{
  "modelList": [
    {
      "profile": {
        "productKey": "test01"
      },
      "services": [
        {
          "outputData": "",
          "identifier": "AngleSelfAdaption",
          "inputData": [
            {
              "identifier": "test01",
              "index": 0
            }
          ],
          "displayName": "test01"
        }
      ],
      "properties": [
        {
          "identifier": "identifier",
          "displayName": "test02"
        },
        {
          "identifier": "identifier_01",
          "displayName": "identifier_01"
        }
      ],
      "events": [
        {
          "outputData": [
            {
              "identifier": "test01",
              "index": 0
            }
          ],
          "identifier": "event1",
          "displayName": "abc"
        }
      ]
    },
    {
      "profile": {
        "productKey": "test02"
      },
      "properties": [
        {
          "originalDataType": {
            "specs": {
              "registerCount": 1,
              "reverseRegister": 0,
              "swap16": 0
            },
            "type": "bool"
          },
          "identifier": "test01",
          "registerAddress": "0x03",
          "scaling": 1,
          "operateType": "inputStatus",
          "pollingTime": 1000,
          "trigger": 1
        },
        {
          "originalDataType": {
            "specs": {
              "registerCount": 1,
              "reverseRegister": 0,
              "swap16": 0
            },
            "type": "bool"
          },
          "identifier": "test02",
          "registerAddress": "0x05",
          "scaling": 1,
          "operateType": "coilStatus",
          "pollingTime": 1000,
          "trigger": 2
        }
      ]
    }
  ],
  "serverList": [
    {
      "baudRate": 1200,
      "protocol": "RTU",
      "byteSize": 8,
      "stopBits": 2,
      "parity": 1,
      "name": "modbus01",
      "serialPort": "0",
      "serverId": "D73251B4277742"
    },
    {
      "protocol": "TCP",
      "port": 8000,
      "ip": "192.168.0.1",
      "name": "modbus02",
      "serverId": "586CB066D6A34"
    },
    {
      "password": "XIJTginONohPEUAyZxLB7Q==",
      "secPolicy": "Basic128Rsa15",
      "name": "server_01",
      "secMode": "Sign",
      "userName": "123",
      "serverId": "55A9D276A7ED470",
      "url": "tcp:00",
      "timeout": 10
    },
    {
      "password": "hAaX5s13gwX2JwyvUkOAfQ==",
      "name": "service_09",
      "secMode": "None",
      "userName": "1234",
      "serverId": "44895C63E3FF401",
      "url": "tcp:00",
      "timeout": 10
    }
  ],
  "deviceList": [
    {
      "deviceConfig": {
        "displayNamePath": "123",
        "serverId": "44895C63E3FF4013924CEF31519ABE7B"
      },
      "productKey": "test01",
      "deviceName": "test_02"
    },
    {
      "deviceConfig": {
        "displayNamePath": "1",
        "serverId": "55A9D276A7ED47"
      },
      "productKey": "test01",
      "deviceName": "test_03"
    },
    {
      "deviceConfig": {
        "slaveId": 1,
        "serverId": "D73251B4277742D"
      },
      "productKey": "test02",
      "deviceName": "test01"
    },
    {
      "deviceConfig": {
        "slaveId": 2,
        "serverId": "586CB066D6A34E"
      },
      "productKey": "test02",
      "deviceName": "test02"
    }
  ],
  "tslList": [
    {
      "schema": "https://iotx-tsl.oss-ap-southeast-1.aliyuncs.com/schema.json",
      "profile": {
        "productKey": "test02"
      },
      "services": [
        {
          "outputData": [],
          "identifier": "set",
          "inputData": [
            {
              "identifier": "test02",
              "dataType": {
                "specs": {
                  "unit": "mm",
                  "min": "0",
                  "max": "1"
                },
                "type": "int"
              },
              "name": "FeatureTest02"
            }
          ],
          "method": "thing.service.property.set",
          "name": "set",
          "required": true,
          "callType": "async",
          "desc": "Set properties"
        },
        {
          "outputData": [
            {
              "identifier": "test01",
              "dataType": {
                "specs": {
                  "unit": "m",
                  "min": "0",
                  "max": "1"
                },
                "type": "int"
              },
              "name": "FeatureTest01"
            },
            {
              "identifier": "test02",
              "dataType": {
                "specs": {
                  "unit": "mm",
                  "min": "0",
                  "max": "1"
                },
                "type": "int"
              },
              "name": "FeatureTest02"
            }
          ],
          "identifier": "get",
          "inputData": [
            "test01",
            "test02"
          ],
          "method": "thing.service.property.get",
          "name": "get",
          "required": true,
          "callType": "async",
          "desc": "Get properties"
        }
      ],
      "properties": [
        {
          "identifier": "test01",
          "dataType": {
            "specs": {
              "unit": "m",
              "min": "0",
              "max": "1"
            },
            "type": "int"
          },
          "name": "FeatureTest01",
          "accessMode": "r",
          "required": false
        },
        {
          "identifier": "test02",
          "dataType": {
            "specs": {
              "unit": "mm",
              "min": "0",
              "max": "1"
            },
            "type": "int"
          },
          "name": "FeatureTest02",
          "accessMode": "rw",
          "required": false
        }
      ],
      "events": [
        {
          "outputData": [
            {
              "identifier": "test01",
              "dataType": {
                "specs": {
                  "unit": "m",
                  "min": "0",
                  "max": "1"
                },
                "type": "int"
              },
              "name": "FeatureTest01"
            },
            {
              "identifier": "test02",
              "dataType": {
                "specs": {
                  "unit": "mm",
                  "min": "0",
                  "max": "1"
                },
                "type": "int"
              },
              "name": "FeatureTest02"
            }
          ],
          "identifier": "post",
          "method": "thing.event.property.post",
          "name": "post",
          "type": "info",
          "required": true,
          "desc": "Report properties"
        }
      ]
    },
    {
      "schema": "https://iotx-tsl.oss-ap-southeast-1.aliyuncs.com/schema.json",
      "profile": {
        "productKey": "test01"
      },
      "services": [
        {
          "outputData": [],
          "identifier": "set",
          "inputData": [
            {
              "identifier": "identifier",
              "dataType": {
                "specs": {
                  "length": "2048"
                },
                "type": "text"
              },
              "name": "7614"
            },
            {
              "identifier": "identifier_01",
              "dataType": {
                "specs": {
                  "length": "2048"
                },
                "type": "text"
              },
              "name": "FeatureTest01"
            }
          ],
          "method": "thing.service.property.set",
          "name": "set",
          "required": true,
          "callType": "async",
          "desc": "Set properties",
        },
        {
          "outputData": [
            {
              "identifier": "identifier",
              "dataType": {
                "specs": {
                  "length": "2048"
                },
                "type": "text"
              },
              "name": "7614"
            },
            {
              "identifier": "identifier_01",
              "dataType": {
                "specs": {
                  "length": "2048"
                },
                "type": "text"
              },
              "name": "FeatureTest01"
            }
          ],
          "identifier": "get",
          "inputData": [
            "identifier",
            "identifier_01"
          ],
          "method": "thing.service.property.get",
          "name": "get",
          "required": true,
          "callType": "async",
          "desc": "Get properties",
        },
        {
          "outputData": [],
          "identifier": "AngleSelfAdaption",
          "inputData": [
            {
              "identifier": "test01",
              "dataType": {
                "specs": {
                  "min": "1",
                  "max": "10",
                  "step": "1"
                },
                "type": "int"
              },
              "name": "Parameter1",
            }
          ],
          "method": "thing.service.AngleSelfAdaption",
          "name": "adaptive angle calibration",
          "required": false,
          "callType": "async"
        }
      ],
      "properties": [
        {
          "identifier": "identifier",
          "dataType": {
            "specs": {
              "length": "2048"
            },
            "type": "text"
          },
          "name": "7614",
          "accessMode": "rw",
          "required": true
        },
        {
          "identifier": "identifier_01",
          "dataType": {
            "specs": {
              "length": "2048"
            },
            "type": "text"
          },
          "name": "FeatureTest01",
          "accessMode": "rw",
          "required": false
        }
      ],
      "events": [
        {
          "outputData": [
            {
              "identifier": "identifier",
              "dataType": {
                "specs": {
                  "length": "2048"
                },
                "type": "text"
              },
              "name": "7614"
            },
            {
              "identifier": "identifier_01",
              "dataType": {
                "specs": {
                  "length": "2048"
                },
                "type": "text"
              },
              "name": "FeatureTest01"
            }
          ],
          "identifier": "post",
          "method": "thing.event.property.post",
          "name": "post",
          "type": "info",
          "required": true,
          "desc": "Report properties."
        },
        {
          "outputData": [
            {
              "identifier": "test01",
              "dataType": {
                "specs": {
                  "min": "1",
                  "max": "20",
                  "step": "1"
                },
                "type": "int"
              },
              "name": "ParameterTest1"
            }
          ],
          "identifier": "event1",
          "method": "thing.event.event1.post",
          "name": "event1",
          "type": "info",
          "required": false
        }
      ]
    }
  ]
}

パラメーターの説明

パラメーター データタイプ 説明
modelList オブジェクト ゲートウェイにマウントされているすべてのサブデバイスの拡張プロダクト情報
serverList オブジェクト ゲートウェイのサブデバイスチャネル
deviceList オブジェクト ゲートウェイにマウントされているすべてのサブデバイスの接続設定
tslList オブジェクト ゲートウェイにマウントされているすべてのサブデバイスの TSL

modelList description

現在、通信プロトコル Modbus と OPC UA がサポートされていますが、2 つのプロトコルの拡張情報は異なります。

  • Modbus

    {
      "profile": {
        "productKey": "test02"
      },
      "properties": [
        {
          "originalDataType": {
            "specs": {
              "registerCount": 1,
              "reverseRegister": 0,
              "swap16": 0
            },
            "type": "bool"
          },
          "identifier": "test01",
          "registerAddress": "0x03",
          "scaling": 1,
          "operateType": "inputStatus",
          "pollingTime": 1000,
          "trigger": 1
        },
        {
          "originalDataType": {
            "specs": {
              "registerCount": 1,
              "reverseRegister": 0,
              "swap16": 0
            },
            "type": "bool"
          },
          "identifier": "test02",
          "registerAddress": "0x05",
          "scaling": 1,
          "operateType": "coilStatus",
          "pollingTime": 1000,
          "trigger": 2
        }
      ]
    }

    パラメーターの説明

    パラメーター データタイプ 説明
    identifier 文字列 プロパティ、イベント、またはサービスの識別子
    operateType 文字列 操作タイプです。 サポートされている値は以下のとおりです。
    • coilStatus
    • inputStatus
    • holdingRegister
    • inputRegister
    registerAddress 文字列 レジスタアドレス
    originalDataType オブジェクト 元のデータ型
    type 文字列 サポートされている値は以下のとおりです。

    int16、uint16、int32、uint32、int64、uint64、float、double、string、およびカスタマイズされたデータ

    specs オブジェクト 説明
    registerCount 整数 レジスタ内のデータ数
    swap16 整数 レジスタ内の 16 ビットデータの最初の 8 ビットと最後の 8 ビットを入れ替えます。 0: false; 1: true.
    reverseRegister 整数 元の 32 ビットデータのビットを入れ替えます。 0: false; 1: true.
    scaling 整数 ズーム倍率
    pollingTime 整数 収集間隔
    trigger 整数 データ報告メソッドです。 1: 特定の時期に報告 2: 変更検出時に報告
  • OPC UA

    {
      "profile": {
        "productKey": "test01"
      },
      "services": [
        {
          "outputData": "",
          "identifier": "AngleSelfAdaption",
          "inputData": [
            {
              "identifier": "test01",
              "index": 0
            }
          ],
          "displayName": "test01"
        }
      ],
      "properties": [
        {
          "identifier": "identifier",
          "displayName": "test02"
        },
        {
          "identifier": "identifier_01",
          "displayName": "identifier_01"
        }
      ],
      "events": [
        {
          "outputData": [
            {
              "identifier": "test01",
              "index": 0
            }
          ],
          "identifier": "event1",
          "displayName": "abc"
        }
      ]
    }

    パラメーターの説明

    パラメーター データタイプ 説明
    サービス オブジェクト サービス
    properties オブジェクト プロパティ
    イベント オブジェクト イベント
    outputData オブジェクト イベント報告データおよびサービス呼び出しに対して戻される結果など出力パラメーター
    identifier 文字列 識別子
    inputData オブジェクト 入力パラメーター
    index 整数 インデックス情報
    displayName 文字列 表示されている名前

serverList description

2 つのプロトコル (Modbus と OPC UA) がチャネルに対してサポートされています。

  • Modbus protocol

    [
      {
        "baudRate": 1200,
        "protocol": "RTU",
        "byteSize": 8,
        "stopBits": 2,
        "parity": 1,
        "name": "modbus01",
        "serialPort": "0",
        "serverId": "D73251B4277742"
      },
      {
        "protocol": "TCP",
        "port": 8000,
        "ip": "192.168.0.1",
        "name": "modbus02",
        "serverId": "586CB066D6A34"
      }
    ]
    パラメーター データタイプ 説明
    protocol 文字列 プロトコルの種類 TCP でも RTU でもかまいません。
    port 整数 ポート番号
    ip 文字列 IP アドレス
    name 文字列 チャネル名
    serverId 文字列 チャネル ID
    baudRate 整数 ボーレート
    byteSize 整数 バイト数
    stopBits 整数 ストップビット
    parity 整数 パリティビットです。 サポートされている値は以下のとおりです。
    • E: 偶数パリティチェック
    • O: 奇数パリティチェック
    • N: パリティチェックなし
    serialPort 文字列 サーバーのポート番号
  • OPC UA プロトコル

    {
      "password": "XIJTginONohPEUAyZxLB7Q==",
      "secPolicy": "Basic128Rsa15",
      "name": "server_01",
      "secMode": "Sign",
      "userName": "123",
      "serverId": "55A9D276A7ED470",
      "url": "tcp:00",
      "timeout": 10
    }

    パラメーターの説明

    パラメーター データタイプ 説明
    password 文字列 AES 暗号化アルゴリズムによって暗号化されたパスワードです。 OPC UA のパスワード暗号化の詳細は、この表の最後にある情報をご参照ください。
    secPolicy 文字列 暗号化ポリシーです。 サポートされているオプションには、None、Basic128Rsa15、および Basic256 があります。
    secMode 文字列 暗号化モード サポートされているオプションには、None、Sign、およびSignAndEncrypt があります。
    name 文字列 サーバー名
    userName 文字列 ユーザー名
    serverId 文字列 サーバー ID
    url 文字列 サーバー接続アドレス
    timeout 整数 タイムアウトの値

    OPC UA のパスワード暗号化方式

    AES 暗号化アルゴリズムと 128 ビット (16 バイト) のグループ化を使用します。 デフォルトのモードは CBC、デフォルトのパディングは PKCS5Padding です。 秘密としてデバイスの deviceSecret を使用します。 暗号化された結果は Base64 でエンコードされています。

    コード例 :

    private static String instance = "AES/CBC/PKCS5Padding";
    
        private static String algorithm = "AES";
    
        private static String charsetName = "utf-8";
        /**
         * Encryption algorithm
         *
         * @param data (Data to be encrypted)
         * @param deviceSecret (The deviceSecret of the device)
         * @return
         */
        public static String aesEncrypt(String data, String deviceSecret) {
            try {
                Cipher cipher = Cipher.getInstance(instance);
                byte[] raw = deviceSecret.getBytes();
                SecretKeySpec key = new SecretKeySpec(raw, algorithm);
                IvParameterSpec ivParameter = new IvParameterSpec(deviceSecret.substring(0, 16).getBytes());
                cipher.init(Cipher.ENCRYPT_MODE, key, ivParameter);
                byte[] encrypted = cipher.doFinal(data.getBytes(charsetName));
    
                return new BASE64Encoder().encode(encrypted);
            } catch (Exception e) {
                e.printStackTrace();
            }
    
            return null;
        }
    
        public static String aesDecrypt(String data, String deviceSecret) {
            try {
                byte[] raw = deviceSecret.getBytes(charsetName);
                byte[] encrypted1 = new BASE64Decoder().decodeBuffer(data);
                SecretKeySpec key = new SecretKeySpec(raw, algorithm);
                Cipher cipher = Cipher.getInstance(instance);
                IvParameterSpec ivParameter = new IvParameterSpec(deviceSecret.substring(0, 16).getBytes());
                cipher.init(Cipher.DECRYPT_MODE, key, ivParameter);
                byte[] originalBytes = cipher.doFinal(encrypted1);
                String originalString = new String(originalBytes, charsetName);
                return originalString;
            } catch (Exception ex) {
                ex.printStackTrace();
            }
    
            return null;
        }
    
        public static void main(String[] args) throws Exception {
            String text = "test123";
            String secret = "testTNmjyWHQzniA8wEkTNmjyWHQtest";
            String data = null;
            data = aesEncrypt(text, secret);
            System.out.println(data);
            System.out.println(aesDecrypt(data, secret));
        }

deviceList description

  • Modbus protocol

    {
      "deviceConfig": {
        "slaveId": 1,
        "serverId": "D73251B4277742D"
      },
      "productKey": "test02",
      "deviceName": "test01"
    }

    パラメーターの説明

    パラメーター データタイプ 説明
    deviceConfig オブジェクト デバイス情報
    slaveId 整数 スレーブ局 ID
    serverId 文字列 チャネル ID
    productKey 文字列 プロダクト ID
    deviceName 文字列 デバイスの名前
  • OPC UA プロトコル

    {
      "deviceConfig": {
        "displayNamePath": "123",
        "serverId": "44895C63E3FF4013924CEF31519ABE7B"
      },
      "productKey": "test01",
      "deviceName": "test_02"
    }

    パラメーターの説明

    パラメーター データタイプ 説明
    deviceConfig オブジェクト デバイス接続設定情報
    productKey 文字列 プロダクト ID
    deviceName 文字列 デバイスの名前
    displayNamePath 文字列 表示されている名前
    serverId 文字列 関連付けられているチャネル ID