modelOfMatterModel.ts 2.59 KB
import {
  DataTypeEnum,
  ExtendDescOperationTypeEnum,
  OriginalDataTypeEnum,
} from '/@/enums/objectModelEnum';
import { FunctionTypeEnum } from '/@/enums/objectModelEnum';

export interface Specs {
  min: number;
  max: number;
  unit: string;
  unitName: string;

  dataType?: string;
  name?: string;
  value?: string | number;
  step: number;
  length: number;
  boolOpen: string;
  boolClose: string;
  valueRange?: {
    min: number;
    max: number;
  };
}

export interface DataType {
  type: DataTypeEnum;
  specs?: Partial<Specs> | StructJSON[];
  specsList?: Specs[];
}

export interface ExtensionDesc {
  writeOnly?: boolean;
  bitMask?: number;
  operationType: ExtendDescOperationTypeEnum;
  originalDataType: OriginalDataTypeEnum;
  registerAddress: string;
  scaling?: number;
  valueRange?: Record<'min' | 'max', number>;
  registerCount?: number;
}

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

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

export interface ModelOfMatterParams {
  deviceProfileId?: string;
  functionJson: FunctionJson;
  functionName: string;
  functionType: FunctionTypeEnum;
  identifier: string;
  remark?: string;
  id?: string;
  categoryId?: string;
  callType?: string;
  eventType?: string;
  accessMode?: string;
  extensionDesc?: ExtensionDesc;
}

export interface GetModelTslParams {
  functionType?: FunctionTypeEnum;
  deviceProfileId: string;
  ifShowClass?: string | Boolean;
}

export interface ImportModelOfMatterType {
  data: Recordable;
  functionType: string;
  tkDeviceProfileId?: string;
  categoryId?: string;
}

export interface ModelOfMatterItemRecordType {
  id: string;
  creator: string;
  createTime: string;
  enabled: boolean;
  tenantId: string;
  functionType: string;
  functionName: string;
  identifier: string;
  extensionDesc: any;
  accessMode: string;
  functionJson: FunctionJson;
  status: number;
  deviceProfileId: string;
}

export interface BatchGetObjectModelItemType {
  id: string;
  name: string;
  transportType: string;
  deviceType: string;
  tsl: Tsl[];
}

export interface Tsl {
  functionName: string;
  identifier: string;
  functionType: string;
  accessMode?: string;
  specs?: {
    dataType: DataType;
  };
  extensionDesc?: ExtensionDesc;
  eventType?: string;
  outputData?: StructJSON[];
  callType?: string;
  inputData?: StructJSON[];
}

export interface UpdateSortThingsModeItemType {
  id: string;
  isCategory: boolean;
  sortType: string;
}