Commit 0b58df1ff6a66f25bd1e885b99c516a4e606bd56

Authored by 云中非
1 parent e7930458

feat: TB页面适配协议扩展

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