Rename DeviceValueTypes, add UINT32 for custom entities #1706

This commit is contained in:
MichaelDvP
2024-04-21 20:06:31 +02:00
parent 0eb04b9027
commit 719cd46a21
31 changed files with 762 additions and 738 deletions

View File

@@ -17,7 +17,7 @@ import {
} from '@mui/material';
import { useEffect, useState } from 'react';
import { DeviceValueUOM_s, DeviceValueType } from './types';
import { DeviceValueUOM_s, DeviceValueType, DeviceValueTypeNames } from './types';
import type { EntityItem } from './types';
import type Schema from 'async-validator';
import type { ValidateFieldsError } from 'async-validator';
@@ -197,14 +197,15 @@ const CustomEntitiesDialog = ({
fullWidth
select
>
<MenuItem value={DeviceValueType.BOOL}>BOOL</MenuItem>
<MenuItem value={DeviceValueType.INT}>INT</MenuItem>
<MenuItem value={DeviceValueType.UINT}>UINT</MenuItem>
<MenuItem value={DeviceValueType.SHORT}>SHORT</MenuItem>
<MenuItem value={DeviceValueType.USHORT}>USHORT</MenuItem>
<MenuItem value={DeviceValueType.ULONG}>ULONG</MenuItem>
<MenuItem value={DeviceValueType.TIME}>TIME</MenuItem>
<MenuItem value={DeviceValueType.STRING}>RAW</MenuItem>
<MenuItem value={DeviceValueType.BOOL}>{DeviceValueTypeNames[DeviceValueType.BOOL]}</MenuItem>
<MenuItem value={DeviceValueType.INT8}>{DeviceValueTypeNames[DeviceValueType.INT8]}</MenuItem>
<MenuItem value={DeviceValueType.UINT8}>{DeviceValueTypeNames[DeviceValueType.UINT8]}</MenuItem>
<MenuItem value={DeviceValueType.INT16}>{DeviceValueTypeNames[DeviceValueType.INT16]}</MenuItem>
<MenuItem value={DeviceValueType.UINT16}>{DeviceValueTypeNames[DeviceValueType.UINT16]}</MenuItem>
<MenuItem value={DeviceValueType.UINT24}>{DeviceValueTypeNames[DeviceValueType.UINT24]}</MenuItem>
<MenuItem value={DeviceValueType.TIME}>{DeviceValueTypeNames[DeviceValueType.TIME]}</MenuItem>
<MenuItem value={DeviceValueType.UINT32}>{DeviceValueTypeNames[DeviceValueType.UINT32]}</MenuItem>
<MenuItem value={DeviceValueType.STRING}>{DeviceValueTypeNames[DeviceValueType.STRING]}</MenuItem>
</TextField>
</Grid>

View File

@@ -377,12 +377,13 @@ export const enum DeviceType {
// matches emsdevicevalue.h
export const enum DeviceValueType {
BOOL,
INT,
UINT,
SHORT,
USHORT,
ULONG,
TIME, // same as ULONG (32 bits)
INT8,
UINT8,
INT16,
UINT16,
UINT24,
TIME, // same as UINT24
UINT32,
ENUM,
STRING,
CMD
@@ -391,12 +392,13 @@ export const enum DeviceValueType {
export const DeviceValueTypeNames = [
//
'BOOL',
'INT',
'UINT',
'SHORT',
'USHORT',
'ULONG',
'INT8',
'UINT8',
'INT16',
'UINT16',
'UINT24',
'TIME',
'UINT32',
'ENUM',
'RAW',
'CMD'