diff options
Diffstat (limited to 'src/common/attributes')
-rw-r--r-- | src/common/attributes/useCommandAttributes.js | 213 | ||||
-rw-r--r-- | src/common/attributes/useCommonDeviceAttributes.js | 21 | ||||
-rw-r--r-- | src/common/attributes/useCommonUserAttributes.js | 136 | ||||
-rw-r--r-- | src/common/attributes/useDeviceAttributes.js | 33 | ||||
-rw-r--r-- | src/common/attributes/useGeofenceAttributes.js | 18 | ||||
-rw-r--r-- | src/common/attributes/useGroupAttributes.js | 12 | ||||
-rw-r--r-- | src/common/attributes/usePositionAttributes.js | 380 | ||||
-rw-r--r-- | src/common/attributes/useServerAttributes.js | 62 | ||||
-rw-r--r-- | src/common/attributes/useUserAttributes.js | 60 |
9 files changed, 935 insertions, 0 deletions
diff --git a/src/common/attributes/useCommandAttributes.js b/src/common/attributes/useCommandAttributes.js new file mode 100644 index 00000000..189a0e2e --- /dev/null +++ b/src/common/attributes/useCommandAttributes.js @@ -0,0 +1,213 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + custom: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + positionPeriodic: [ + { + key: 'frequency', + name: t('commandFrequency'), + type: 'number', + }, + ], + setTimezone: [ + { + key: 'timezone', + name: t('commandTimezone'), + type: 'string', + }, + ], + sendSms: [ + { + key: 'phone', + name: t('commandPhone'), + type: 'string', + }, + { + key: 'message', + name: t('commandMessage'), + type: 'string', + }, + ], + message: [ + { + key: 'message', + name: t('commandMessage'), + type: 'string', + }, + ], + sendUssd: [ + { + key: 'phone', + name: t('commandPhone'), + type: 'string', + }, + ], + sosNumber: [ + { + key: 'index', + name: t('commandIndex'), + type: 'number', + }, + { + key: 'phone', + name: t('commandPhone'), + type: 'string', + }, + ], + silenceTime: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + setPhonebook: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + voiceMessage: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + outputControl: [ + { + key: 'index', + name: t('commandIndex'), + type: 'number', + }, + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + voiceMonitoring: [ + { + key: 'enable', + name: t('commandEnable'), + type: 'boolean', + }, + ], + setAgps: [ + { + key: 'enable', + name: t('commandEnable'), + type: 'boolean', + }, + ], + setIndicator: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + configuration: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + setConnection: [ + { + key: 'server', + name: t('commandServer'), + type: 'string', + }, + { + key: 'port', + name: t('commandPort'), + type: 'number', + }, + ], + setOdometer: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + modePowerSaving: [ + { + key: 'enable', + name: t('commandEnable'), + type: 'boolean', + }, + ], + modeDeepSleep: [ + { + key: 'enable', + name: t('commandEnable'), + type: 'boolean', + }, + ], + alarmGeofence: [ + { + key: 'radius', + name: t('commandRadius'), + type: 'number', + }, + ], + alarmBattery: [ + { + key: 'enable', + name: t('commandEnable'), + type: 'boolean', + }, + ], + alarmSos: [ + { + key: 'enable', + name: t('commandEnable'), + type: 'boolean', + }, + ], + alarmRemove: [ + { + key: 'enable', + name: t('commandEnable'), + type: 'boolean', + }, + ], + alarmClock: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + alarmSpeed: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], + alarmFall: [ + { + key: 'enable', + name: t('commandEnable'), + type: 'boolean', + }, + ], + alarmVibration: [ + { + key: 'data', + name: t('commandData'), + type: 'string', + }, + ], +}), [t]); diff --git a/src/common/attributes/useCommonDeviceAttributes.js b/src/common/attributes/useCommonDeviceAttributes.js new file mode 100644 index 00000000..f9214818 --- /dev/null +++ b/src/common/attributes/useCommonDeviceAttributes.js @@ -0,0 +1,21 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + speedLimit: { + name: t('attributeSpeedLimit'), + type: 'number', + subtype: 'speed', + }, + fuelDropThreshold: { + name: t('attributeFuelDropThreshold'), + type: 'number', + }, + fuelIncreaseThreshold: { + name: t('attributeFuelIncreaseThreshold'), + type: 'number', + }, + 'report.ignoreOdometer': { + name: t('attributeReportIgnoreOdometer'), + type: 'boolean', + }, +}), [t]); diff --git a/src/common/attributes/useCommonUserAttributes.js b/src/common/attributes/useCommonUserAttributes.js new file mode 100644 index 00000000..294ddea8 --- /dev/null +++ b/src/common/attributes/useCommonUserAttributes.js @@ -0,0 +1,136 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + mapGeofences: { + name: t('attributeShowGeofences'), + type: 'boolean', + }, + mapLiveRoutes: { + name: t('mapLiveRoutes'), + type: 'string', + }, + mapDirection: { + name: t('mapDirection'), + type: 'string', + }, + mapFollow: { + name: t('deviceFollow'), + type: 'boolean', + }, + mapCluster: { + name: t('mapClustering'), + type: 'boolean', + }, + mapOnSelect: { + name: t('mapOnSelect'), + type: 'boolean', + }, + activeMapStyles: { + name: t('mapActive'), + type: 'string', + }, + devicePrimary: { + name: t('devicePrimaryInfo'), + type: 'string', + }, + deviceSecondary: { + name: t('deviceSecondaryInfo'), + type: 'string', + }, + soundEvents: { + name: t('eventsSoundEvents'), + type: 'string', + }, + soundAlarms: { + name: t('eventsSoundAlarms'), + type: 'string', + }, + positionItems: { + name: t('attributePopupInfo'), + type: 'string', + }, + locationIqKey: { + name: t('mapLocationIqKey'), + type: 'string', + }, + mapboxAccessToken: { + name: t('mapMapboxKey'), + type: 'string', + }, + mapTilerKey: { + name: t('mapMapTilerKey'), + type: 'string', + }, + bingMapsKey: { + name: t('mapBingKey'), + type: 'string', + }, + openWeatherKey: { + name: t('mapOpenWeatherKey'), + type: 'string', + }, + tomTomKey: { + name: t('mapTomTomKey'), + type: 'string', + }, + hereKey: { + name: t('mapHereKey'), + type: 'string', + }, + notificationTokens: { + name: t('attributeNotificationTokens'), + type: 'string', + }, + 'ui.disableSavedCommands': { + name: t('attributeUiDisableSavedCommands'), + type: 'boolean', + }, + 'ui.disableGroups': { + name: t('attributeUiDisableGroups'), + type: 'boolean', + }, + 'ui.disableAttributes': { + name: t('attributeUiDisableAttributes'), + type: 'boolean', + }, + 'ui.disableEvents': { + name: t('attributeUiDisableEvents'), + type: 'boolean', + }, + 'ui.disableVehicleFeatures': { + name: t('attributeUiDisableVehicleFeatures'), + type: 'boolean', + }, + 'ui.disableDrivers': { + name: t('attributeUiDisableDrivers'), + type: 'boolean', + }, + 'ui.disableComputedAttributes': { + name: t('attributeUiDisableComputedAttributes'), + type: 'boolean', + }, + 'ui.disableCalendars': { + name: t('attributeUiDisableCalendars'), + type: 'boolean', + }, + 'ui.disableMaintenance': { + name: t('attributeUiDisableMaintenance'), + type: 'boolean', + }, + 'web.liveRouteLength': { + name: t('attributeWebLiveRouteLength'), + type: 'number', + }, + 'web.selectZoom': { + name: t('attributeWebSelectZoom'), + type: 'number', + }, + 'web.maxZoom': { + name: t('attributeWebMaxZoom'), + type: 'number', + }, + iconScale: { + name: t('sharedIconScale'), + type: 'number', + }, +}), [t]); diff --git a/src/common/attributes/useDeviceAttributes.js b/src/common/attributes/useDeviceAttributes.js new file mode 100644 index 00000000..eab9b8f6 --- /dev/null +++ b/src/common/attributes/useDeviceAttributes.js @@ -0,0 +1,33 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + 'web.reportColor': { + name: t('attributeWebReportColor'), + type: 'string', + subtype: 'color', + }, + devicePassword: { + name: t('attributeDevicePassword'), + type: 'string', + }, + deviceImage: { + name: t('attributeDeviceImage'), + type: 'string', + }, + 'processing.copyAttributes': { + name: t('attributeProcessingCopyAttributes'), + type: 'string', + }, + 'decoder.timezone': { + name: t('sharedTimezone'), + type: 'string', + }, + deviceInactivityStart: { + name: t('attributeDeviceInactivityStart'), + type: 'number', + }, + deviceInactivityPeriod: { + name: t('attributeDeviceInactivityPeriod'), + type: 'number', + }, +}), [t]); diff --git a/src/common/attributes/useGeofenceAttributes.js b/src/common/attributes/useGeofenceAttributes.js new file mode 100644 index 00000000..a5cd068b --- /dev/null +++ b/src/common/attributes/useGeofenceAttributes.js @@ -0,0 +1,18 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + color: { + name: t('attributeColor'), + type: 'string', + }, + speedLimit: { + name: t('attributeSpeedLimit'), + type: 'number', + subtype: 'speed', + }, + polylineDistance: { + name: t('attributePolylineDistance'), + type: 'number', + subtype: 'distance', + }, +}), [t]); diff --git a/src/common/attributes/useGroupAttributes.js b/src/common/attributes/useGroupAttributes.js new file mode 100644 index 00000000..53a299e1 --- /dev/null +++ b/src/common/attributes/useGroupAttributes.js @@ -0,0 +1,12 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + 'processing.copyAttributes': { + name: t('attributeProcessingCopyAttributes'), + type: 'string', + }, + 'decoder.timezone': { + name: t('sharedTimezone'), + type: 'string', + }, +}), [t]); diff --git a/src/common/attributes/usePositionAttributes.js b/src/common/attributes/usePositionAttributes.js new file mode 100644 index 00000000..0b191ebc --- /dev/null +++ b/src/common/attributes/usePositionAttributes.js @@ -0,0 +1,380 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + id: { + name: t('deviceIdentifier'), + type: 'number', + property: true, + }, + latitude: { + name: t('positionLatitude'), + type: 'number', + property: true, + }, + longitude: { + name: t('positionLongitude'), + type: 'number', + property: true, + }, + speed: { + name: t('positionSpeed'), + type: 'number', + dataType: 'speed', + property: true, + }, + course: { + name: t('positionCourse'), + type: 'number', + property: true, + }, + altitude: { + name: t('positionAltitude'), + type: 'number', + property: true, + }, + accuracy: { + name: t('positionAccuracy'), + type: 'number', + dataType: 'distance', + property: true, + }, + valid: { + name: t('positionValid'), + type: 'boolean', + property: true, + }, + protocol: { + name: t('positionProtocol'), + type: 'string', + property: true, + }, + address: { + name: t('positionAddress'), + type: 'string', + property: true, + }, + deviceTime: { + name: t('positionDeviceTime'), + type: 'string', + property: true, + }, + fixTime: { + name: t('positionFixTime'), + type: 'string', + property: true, + }, + serverTime: { + name: t('positionServerTime'), + type: 'string', + property: true, + }, + geofenceIds: { + name: t('sharedGeofences'), + property: true, + }, + raw: { + name: t('positionRaw'), + type: 'string', + }, + index: { + name: t('positionIndex'), + type: 'number', + }, + hdop: { + name: t('positionHdop'), + type: 'number', + }, + vdop: { + name: t('positionVdop'), + type: 'number', + }, + pdop: { + name: t('positionPdop'), + type: 'number', + }, + sat: { + name: t('positionSat'), + type: 'number', + }, + satVisible: { + name: t('positionSatVisible'), + type: 'number', + }, + rssi: { + name: t('positionRssi'), + type: 'number', + }, + coolantTemp: { + name: t('positionCoolantTemp'), + type: 'number', + }, + gps: { + name: t('positionGps'), + type: 'number', + }, + roaming: { + name: t('positionRoaming'), + type: 'boolean', + }, + event: { + name: t('positionEvent'), + type: 'string', + }, + alarm: { + name: t('positionAlarm'), + type: 'string', + }, + status: { + name: t('positionStatus'), + type: 'string', + }, + odometer: { + name: t('positionOdometer'), + type: 'number', + dataType: 'distance', + }, + serviceOdometer: { + name: t('positionServiceOdometer'), + type: 'number', + dataType: 'distance', + }, + tripOdometer: { + name: t('positionTripOdometer'), + type: 'number', + dataType: 'distance', + }, + hours: { + name: t('positionHours'), + type: 'number', + dataType: 'hours', + }, + steps: { + name: t('positionSteps'), + type: 'number', + }, + heartRate: { + name: t('positionHeartRate'), + type: 'number', + }, + input: { + name: t('positionInput'), + type: 'number', + }, + in1: { + name: `${t('positionInput')} 1`, + type: 'boolean', + }, + in2: { + name: `${t('positionInput')} 2`, + type: 'boolean', + }, + in3: { + name: `${t('positionInput')} 3`, + type: 'boolean', + }, + in4: { + name: `${t('positionInput')} 4`, + type: 'boolean', + }, + output: { + name: t('positionOutput'), + type: 'number', + }, + out1: { + name: `${t('positionOutput')} 1`, + type: 'boolean', + }, + out2: { + name: `${t('positionOutput')} 2`, + type: 'boolean', + }, + out3: { + name: `${t('positionOutput')} 3`, + type: 'boolean', + }, + out4: { + name: `${t('positionOutput')} 4`, + type: 'boolean', + }, + power: { + name: t('positionPower'), + type: 'number', + dataType: 'voltage', + }, + battery: { + name: t('positionBattery'), + type: 'number', + dataType: 'voltage', + }, + batteryLevel: { + name: t('positionBatteryLevel'), + type: 'number', + dataType: 'percentage', + }, + fuel: { + name: t('positionFuel'), + type: 'number', + dataType: 'volume', + }, + fuelConsumption: { + name: t('positionFuelConsumption'), + type: 'number', + }, + versionFw: { + name: t('positionVersionFw'), + type: 'string', + }, + versionHw: { + name: t('positionVersionHw'), + type: 'string', + }, + type: { + name: t('sharedType'), + type: 'string', + }, + ignition: { + name: t('positionIgnition'), + type: 'boolean', + }, + flags: { + name: t('positionFlags'), + type: 'string', + }, + charge: { + name: t('positionCharge'), + type: 'boolean', + }, + ip: { + name: t('positionIp'), + type: 'string', + }, + archive: { + name: t('positionArchive'), + type: 'boolean', + }, + distance: { + name: t('positionDistance'), + type: 'number', + dataType: 'distance', + }, + totalDistance: { + name: t('deviceTotalDistance'), + type: 'number', + dataType: 'distance', + }, + rpm: { + name: t('positionRpm'), + type: 'number', + }, + vin: { + name: t('positionVin'), + type: 'string', + }, + approximate: { + name: t('positionApproximate'), + type: 'boolean', + }, + throttle: { + name: t('positionThrottle'), + type: 'number', + }, + motion: { + name: t('positionMotion'), + type: 'boolean', + }, + armed: { + name: t('positionArmed'), + type: 'boolean', + }, + geofence: { + name: t('sharedGeofence'), + type: 'string', + }, + acceleration: { + name: t('positionAcceleration'), + type: 'number', + }, + deviceTemp: { + name: t('positionDeviceTemp'), + type: 'number', + }, + temp1: { + name: `${t('positionTemp')} 1`, + type: 'number', + }, + temp2: { + name: `${t('positionTemp')} 2`, + type: 'number', + }, + temp3: { + name: `${t('positionTemp')} 3`, + type: 'number', + }, + temp4: { + name: `${t('positionTemp')} 4`, + type: 'number', + }, + operator: { + name: t('positionOperator'), + type: 'string', + }, + command: { + name: t('deviceCommand'), + type: 'string', + }, + blocked: { + name: t('positionBlocked'), + type: 'boolean', + }, + lock: { + name: t('alarmLock'), + type: 'boolean', + }, + dtcs: { + name: t('positionDtcs'), + type: 'string', + }, + obdSpeed: { + name: t('positionObdSpeed'), + type: 'number', + dataType: 'speed', + }, + obdOdometer: { + name: t('positionObdOdometer'), + type: 'number', + dataType: 'distance', + }, + result: { + name: t('eventCommandResult'), + type: 'string', + }, + driverUniqueId: { + name: t('sharedDriver'), + type: 'string', + }, + card: { + name: t('positionCard'), + type: 'string', + }, + drivingTime: { + name: t('positionDrivingTime'), + type: 'number', + dataType: 'hours', + }, + color: { + name: t('attributeColor'), + type: 'string', + }, + image: { + name: t('positionImage'), + type: 'string', + }, + video: { + name: t('positionVideo'), + type: 'string', + }, + audio: { + name: t('positionAudio'), + type: 'string', + }, +}), [t]); diff --git a/src/common/attributes/useServerAttributes.js b/src/common/attributes/useServerAttributes.js new file mode 100644 index 00000000..80ac3c7d --- /dev/null +++ b/src/common/attributes/useServerAttributes.js @@ -0,0 +1,62 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + support: { + name: t('settingsSupport'), + type: 'string', + }, + title: { + name: t('serverName'), + type: 'string', + }, + description: { + name: t('serverDescription'), + type: 'string', + }, + logo: { + name: t('serverLogo'), + type: 'string', + }, + logoInverted: { + name: t('serverLogoInverted'), + type: 'string', + }, + colorPrimary: { + name: t('serverColorPrimary'), + type: 'string', + subtype: 'color', + }, + colorSecondary: { + name: t('serverColorSecondary'), + type: 'string', + subtype: 'color', + }, + disableChange: { + name: t('serverChangeDisable'), + type: 'boolean', + }, + darkMode: { + name: t('settingsDarkMode'), + type: 'boolean', + }, + totpEnable: { + name: t('settingsTotpEnable'), + type: 'boolean', + }, + totpForce: { + name: t('settingsTotpForce'), + type: 'boolean', + }, + serviceWorkerUpdateInterval: { + name: t('settingsServiceWorkerUpdateInterval'), + type: 'number', + }, + 'ui.disableLoginLanguage': { + name: t('attributeUiDisableLoginLanguage'), + type: 'boolean', + }, + disableShare: { + name: t('serverDisableShare'), + type: 'boolean', + }, +}), [t]); diff --git a/src/common/attributes/useUserAttributes.js b/src/common/attributes/useUserAttributes.js new file mode 100644 index 00000000..81230884 --- /dev/null +++ b/src/common/attributes/useUserAttributes.js @@ -0,0 +1,60 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + telegramChatId: { + name: t('attributeTelegramChatId'), + type: 'string', + }, + pushoverUserKey: { + name: t('attributePushoverUserKey'), + type: 'string', + }, + pushoverDeviceNames: { + name: t('attributePushoverDeviceNames'), + type: 'string', + }, + 'mail.smtp.host': { + name: t('attributeMailSmtpHost'), + type: 'string', + }, + 'mail.smtp.port': { + name: t('attributeMailSmtpPort'), + type: 'number', + }, + 'mail.smtp.starttls.enable': { + name: t('attributeMailSmtpStarttlsEnable'), + type: 'boolean', + }, + 'mail.smtp.starttls.required': { + name: t('attributeMailSmtpStarttlsRequired'), + type: 'boolean', + }, + 'mail.smtp.ssl.enable': { + name: t('attributeMailSmtpSslEnable'), + type: 'boolean', + }, + 'mail.smtp.ssl.trust': { + name: t('attributeMailSmtpSslTrust'), + type: 'string', + }, + 'mail.smtp.ssl.protocols': { + name: t('attributeMailSmtpSslProtocols'), + type: 'string', + }, + 'mail.smtp.from': { + name: t('attributeMailSmtpFrom'), + type: 'string', + }, + 'mail.smtp.auth': { + name: t('attributeMailSmtpAuth'), + type: 'boolean', + }, + 'mail.smtp.username': { + name: t('attributeMailSmtpUsername'), + type: 'string', + }, + 'mail.smtp.password': { + name: t('attributeMailSmtpPassword'), + type: 'string', + }, +}), [t]); |