Commit 0b58df1ff6a66f25bd1e885b99c516a4e606bd56

Authored by 云中非
1 parent e7930458

feat: TB页面适配协议扩展

... ... @@ -44,6 +44,7 @@ export enum DeviceProfileType {
44 44 export enum DeviceTransportType {
45 45 DEFAULT = 'DEFAULT',
46 46 MQTT = 'MQTT',
  47 + TCP = 'TCP',
47 48 COAP = 'COAP',
48 49 LWM2M = 'LWM2M',
49 50 SNMP = 'SNMP'
... ... @@ -99,6 +100,7 @@ export const deviceTransportTypeTranslationMap = new Map<DeviceTransportType, st
99 100 [
100 101 [DeviceTransportType.DEFAULT, 'device-profile.transport-type-default'],
101 102 [DeviceTransportType.MQTT, 'device-profile.transport-type-mqtt'],
  103 + [DeviceTransportType.TCP, 'device-profile.transport-type-tcp'],
102 104 [DeviceTransportType.COAP, 'device-profile.transport-type-coap'],
103 105 [DeviceTransportType.LWM2M, 'device-profile.transport-type-lwm2m'],
104 106 [DeviceTransportType.SNMP, 'device-profile.transport-type-snmp']
... ... @@ -118,6 +120,7 @@ export const deviceTransportTypeHintMap = new Map<DeviceTransportType, string>(
118 120 [
119 121 [DeviceTransportType.DEFAULT, 'device-profile.transport-type-default-hint'],
120 122 [DeviceTransportType.MQTT, 'device-profile.transport-type-mqtt-hint'],
  123 + [DeviceTransportType.TCP, 'device-profile.transport-type-mqtt-hint'],
121 124 [DeviceTransportType.COAP, 'device-profile.transport-type-coap-hint'],
122 125 [DeviceTransportType.LWM2M, 'device-profile.transport-type-lwm2m-hint'],
123 126 [DeviceTransportType.SNMP, 'device-profile.transport-type-snmp-hint']
... ... @@ -202,6 +205,13 @@ export const deviceTransportTypeConfigurationInfoMap = new Map<DeviceTransportTy
202 205 }
203 206 ],
204 207 [
  208 + DeviceTransportType.TCP,
  209 + {
  210 + hasProfileConfiguration: true,
  211 + hasDeviceConfiguration: false,
  212 + }
  213 + ],
  214 + [
205 215 DeviceTransportType.LWM2M,
206 216 {
207 217 hasProfileConfiguration: true,
... ... @@ -250,6 +260,11 @@ export interface MqttDeviceProfileTransportConfiguration {
250 260 [key: string]: any;
251 261 }
252 262
  263 +//Thingskit function
  264 +export interface YtTcpDeviceProfileTransportConfiguration {
  265 + [key: string]: any;
  266 +}
  267 +
253 268 export interface CoapClientSetting {
254 269 powerMode?: PowerMode | null;
255 270 edrxCycle?: number;
... ... @@ -306,6 +321,7 @@ export interface SnmpMapping {
306 321
307 322 export type DeviceProfileTransportConfigurations = DefaultDeviceProfileTransportConfiguration &
308 323 MqttDeviceProfileTransportConfiguration &
  324 + YtTcpDeviceProfileTransportConfiguration &
309 325 CoapDeviceProfileTransportConfiguration &
310 326 Lwm2mDeviceProfileTransportConfiguration &
311 327 SnmpDeviceProfileTransportConfiguration;
... ... @@ -366,6 +382,10 @@ export function createDeviceProfileTransportConfiguration(type: DeviceTransportT
366 382 };
367 383 transportConfiguration = {...mqttTransportConfiguration, type: DeviceTransportType.MQTT};
368 384 break;
  385 + case DeviceTransportType.TCP:
  386 + const tcpTransportConfiguration: YtTcpDeviceProfileTransportConfiguration = {};
  387 + transportConfiguration = {...tcpTransportConfiguration, type: DeviceTransportType.TCP};
  388 + break;
369 389 case DeviceTransportType.COAP:
370 390 const coapTransportConfiguration: CoapDeviceProfileTransportConfiguration = {
371 391 coapDeviceTypeConfiguration: {
... ... @@ -411,6 +431,10 @@ export function createDeviceTransportConfiguration(type: DeviceTransportType): D
411 431 const mqttTransportConfiguration: MqttDeviceTransportConfiguration = {};
412 432 transportConfiguration = {...mqttTransportConfiguration, type: DeviceTransportType.MQTT};
413 433 break;
  434 + case DeviceTransportType.TCP:
  435 + const tcpTransportConfiguration: YtTcpDeviceTransportConfiguration = {};
  436 + transportConfiguration = {...tcpTransportConfiguration, type: DeviceTransportType.TCP};
  437 + break;
414 438 case DeviceTransportType.COAP:
415 439 const coapTransportConfiguration: CoapDeviceTransportConfiguration = {
416 440 powerMode: null
... ... @@ -600,6 +624,10 @@ export interface MqttDeviceTransportConfiguration {
600 624 [key: string]: any;
601 625 }
602 626
  627 +export interface YtTcpDeviceTransportConfiguration {
  628 + [key: string]: any;
  629 +}
  630 +
603 631 export interface CoapDeviceTransportConfiguration {
604 632 powerMode?: PowerMode | null;
605 633 edrxCycle?: number;
... ... @@ -725,6 +753,9 @@ export const credentialTypesByTransportType = new Map<DeviceTransportType, Devic
725 753 [DeviceTransportType.MQTT, [
726 754 DeviceCredentialsType.ACCESS_TOKEN, DeviceCredentialsType.X509_CERTIFICATE, DeviceCredentialsType.MQTT_BASIC
727 755 ]],
  756 + [DeviceTransportType.TCP, [
  757 + DeviceCredentialsType.ACCESS_TOKEN
  758 + ]],
728 759 [DeviceTransportType.COAP, [DeviceCredentialsType.ACCESS_TOKEN, DeviceCredentialsType.X509_CERTIFICATE]],
729 760 [DeviceTransportType.LWM2M, [DeviceCredentialsType.LWM2M_CREDENTIALS]],
730 761 [DeviceTransportType.SNMP, [DeviceCredentialsType.ACCESS_TOKEN]]
... ...
... ... @@ -999,6 +999,7 @@
999 999 "transport-type-lwm2m": "LWM2M",
1000 1000 "transport-type-lwm2m-hint": "LWM2M传输类型",
1001 1001 "transport-type-mqtt": "MQTT",
  1002 + "transport-type-tcp": "TCP",
1002 1003 "transport-type-mqtt-hint": "启用高级MQTT传输设置",
1003 1004 "transport-type-required": "传输方式必填。",
1004 1005 "transport-type-snmp-hint": "指定 SNMP 传输配置",
... ...