/******************************************************************************* * Copyright 2017 Dell Inc. * Copyright (c) 2019 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. *******************************************************************************/ package constants import ( "github.com/winc-link/edge-driver-proto/drivercommon" "github.com/winc-link/edge-driver-proto/driverproduct" ) type IotPlatform string const ( IotPlatform_LocalIot IotPlatform = "本地" IotPlatform_CustomerIot IotPlatform = "用户自定义" //用户自定义 IotPlatform_WinCLinkIot IotPlatform = "赢创万联" //赢创万联 IotPlatform_AliIot IotPlatform = "阿里云" //阿里 IotPlatform_HuaweiIot IotPlatform = "华为云" //华为 IotPlatform_TencentIot IotPlatform = "腾讯云" //腾讯 IotPlatform_TuyaIot IotPlatform = "涂鸦云" //涂鸦 IotPlatform_OneNetIot IotPlatform = "OneNET" //中国移动 ) func (i IotPlatform) TransformToCloudInstancePlatform() string { switch i { case IotPlatform_WinCLinkIot: return CloudServiceWincLinkName case IotPlatform_AliIot: return CloudServiceAliyunName case IotPlatform_HuaweiIot: return CloudServiceHuaweiName case IotPlatform_TencentIot: return CloudServiceTencentName case IotPlatform_TuyaIot: return CloudServiceTuyaName case IotPlatform_OneNetIot: return CloudServiceOneNETName default: return "" } } func (i IotPlatform) TransformToDriverDevicePlatform() drivercommon.IotPlatform { switch i { case IotPlatform_LocalIot: return drivercommon.IotPlatform_LocalIot case IotPlatform_WinCLinkIot: return drivercommon.IotPlatform_WinCLinkIot case IotPlatform_AliIot: return drivercommon.IotPlatform_AliIot case IotPlatform_HuaweiIot: return drivercommon.IotPlatform_HuaweiIot case IotPlatform_TencentIot: return drivercommon.IotPlatform_TencentIot case IotPlatform_TuyaIot: return drivercommon.IotPlatform_TuyaIot case IotPlatform_OneNetIot: return drivercommon.IotPlatform_OneNetIot default: return drivercommon.IotPlatform_LocalIot } } func TransformEdgePlatformToDbPlatform(platform drivercommon.IotPlatform) IotPlatform { switch platform { case drivercommon.IotPlatform_CustomerIot: return IotPlatform_CustomerIot case drivercommon.IotPlatform_WinCLinkIot: return IotPlatform_WinCLinkIot case drivercommon.IotPlatform_AliIot: return IotPlatform_AliIot case drivercommon.IotPlatform_HuaweiIot: return IotPlatform_HuaweiIot case drivercommon.IotPlatform_TencentIot: return IotPlatform_TencentIot case drivercommon.IotPlatform_TuyaIot: return IotPlatform_TuyaIot case drivercommon.IotPlatform_OneNetIot: return IotPlatform_OneNetIot case drivercommon.IotPlatform_LocalIot: return IotPlatform_LocalIot default: return IotPlatform("") } } type SpecsType string const ( SpecsTypeInt SpecsType = "int" SpecsTypeFloat SpecsType = "float" SpecsTypeText SpecsType = "text" SpecsTypeDate SpecsType = "date" SpecsTypeBool SpecsType = "bool" SpecsTypeEnum SpecsType = "enum" SpecsTypeStruct SpecsType = "struct" SpecsTypeArray SpecsType = "array" ) func (i SpecsType) AllowSendInEkuiper() bool { if i == SpecsTypeInt || i == SpecsTypeFloat || i == SpecsTypeText || i == SpecsTypeBool || i == SpecsTypeEnum { return true } return false } type ProductNodeType string const ( ProductNodeTypeUnKnow ProductNodeType = "其他" ProductNodeTypeGateway ProductNodeType = "网关" ProductNodeTypeDevice ProductNodeType = "直连设备" ProductNodeTypeSubDevice ProductNodeType = "网关子设备" ) func (i ProductNodeType) TransformToDriverProductNodeType() driverproduct.ProductNodeType { switch i { case ProductNodeTypeUnKnow: return driverproduct.ProductNodeType_UnKnow case ProductNodeTypeGateway: return driverproduct.ProductNodeType_Gateway case ProductNodeTypeDevice: return driverproduct.ProductNodeType_Device case ProductNodeTypeSubDevice: return driverproduct.ProductNodeType_SubDevice default: return driverproduct.ProductNodeType_UnKnow } } type ProductStatus string const ( ProductRelease ProductStatus = "已发布" ProductUnRelease ProductStatus = "未发布" ) type ProductNetType string const ( ProductNetTypeOther ProductNetType = "其他" ProductNetTypeCellular ProductNetType = "蜂窝" ProductNetTypeWifi ProductNetType = "WIFI" ProductNetTypeEthernet ProductNetType = "以太网" ProductNetTypeNB ProductNetType = "NB" ) func (i ProductNetType) TransformToDriverProductNetType() driverproduct.ProductNetType { switch i { case ProductNetTypeOther: return driverproduct.ProductNetType_Other case ProductNetTypeCellular: return driverproduct.ProductNetType_Cellular case ProductNetTypeWifi: return driverproduct.ProductNetType_Wifi case ProductNetTypeEthernet: return driverproduct.ProductNetType_Ethernet case ProductNetTypeNB: return driverproduct.ProductNetType_NB default: return driverproduct.ProductNetType_Other } } type ProductProtocol string const ( ProductProtocolMQTT ProductProtocol = "MQTT" ProductProtocolCoAP ProductProtocol = "CoAP" ProductProtocolLwM2M ProductProtocol = "LwM2M" ProductProtocolHttp ProductProtocol = "HTTP" ProductProtocolOther ProductProtocol = "其他" ) type TagName string const ( TagNameCustom TagName = "自定义" TagNameSystem TagName = "系统" ) type EventType string const ( EventTypeInfo EventType = "info" EventTypeAlert EventType = "alert" EventTypeError EventType = "error" ) type CallType string const ( CallTypeSync CallType = "SYNC" //同步 CallTypeAsync CallType = "ASYNC" //异步 )