index.ts 3.37 KB
import type { FunctionType, TransportTypeEnum } from '@/enums/datasource'

export interface DeviceProfileItemType {
  id: string
  creator: string
  createTime: string
  name: string
  description: string
  tenantId: string
  transportType: string
  provisionType: string
  deviceType: string
  tbProfileId: string
  profileData: ProfileData
  type: string
  default: boolean
}

export interface ProfileData {
  configuration: Configuration
  transportConfiguration: TransportConfiguration
  provisionConfiguration: ProvisionConfiguration
  alarms: any
  thingsModel: ThingsModel[]
}

interface AdditionalInfo {
  cmdType: string
}
export interface SendValue {
  additionalInfo: AdditionalInfo
  method: string
  params: Object
  persistent: boolean
}

export interface Configuration {
  type: string
}

export interface TransportConfiguration {
  type: string
}

export interface ProvisionConfiguration {
  type: string
  provisionDeviceSecret: any
}

export interface StructJSON {
  functionName: string
  identifier: string
  remark?: string
  dataType?: DataType
  serviceCommand?: string
  accessMode?: string
}

export interface ThingsModel {
  functionType: FunctionType
  functionName: string
  identifier: string
  callType: any
  accessMode: string
  eventType: any
  functionJson: FunctionJson
  status: number
  deviceProfileId: string
  remark: any
  extensionDesc?: Recordable
}

export interface FunctionJson {
  dataType: DataType | DataType[]
  inputData?: StructJSON[]
  outputData?: StructJSON[]
  serviceCommand?: string
}

export interface OrganizationItemType {
  id: string
  creator: string
  createTime: string
  name: string
  enabled: boolean
  tenantId: string
  parentId: string
  sort: number
  updater?: string
  updateTime?: string
  children: OrganizationItemType[]
}

export interface DeviceItemType {
  id: string
  creator: string
  createTime: string
  updater: string
  updateTime: string
  name: string
  enabled: boolean
  tenantId: string
  deviceInfo: DeviceInfo
  alias: string
  deviceState: string
  profileId: string
  deviceProfileId: string
  gatewayId: string
  tbDeviceId: string
  brand: string
  sn: string
  code: string
  codeType: string
  organizationId: string
  deviceType: string
  alarmStatus: number
  enable: boolean

  transportType: TransportTypeEnum
}

export interface DeviceInfo {
  longitude: number
  latitude: number
  address: string
}

export interface ThingsModelItemType {
  identifier: string
  extensionDesc?: ExtensionDesc
  name: string
  detail: Detail
  accessMode: string
}

export interface ExtensionDesc {
  zoomFactor?: number
  actionType?: string
  dataType: string
  registerAddress: number
}

export interface Detail {
  dataType: DataType
}

export interface DataType {
  type: string
  specs: Specs | StructJSON[]
}

export interface Specs {
  valueRange?: ValueRange
  unit?: Unit
  unitName?: string
  boolOpen?: string
  boolClose?: string
  length?: string
  min: string
  max: string
}

export interface ValueRange {
  min: number
  max: number
}

export interface Unit {
  value: string
  label: string
  key: string
}

export interface RpcCommandType {
  additionalInfo: Recordable
  method: string
  params: Recordable | string | number
  persistent: boolean
}

export interface DeviceAttributeItemType {
  key: string
  value: boolean
  lastUpdateTs: number
}

export interface DeviceActiveType {
  key: string
  lastUpdateTs: number
  value: boolean
}