@camera.ui/sdk / sensor / defineMeasurement
Function: defineMeasurement() ​
defineMeasurement<
T,K>(type,assignmentKey,definition):object
Defined in: sensor/measurement.ts:106
Declares the metadata of a measurement type: one current reading with a unit and the range the quantity can have.
Type Parameters ​
T ​
T extends SensorType
K ​
K extends string
Parameters ​
type ​
T
The sensor type.
assignmentKey ​
K
Key under which a camera stores its assignment for the type.
definition ​
Unit, device class, starting value and range of the reading.
Returns ​
object
The metadata, with type and assignmentKey preserved as literal types.
assignmentKey ​
assignmentKey:
K
category ​
readonlycategory:Info=SensorCategory.Info
isDetectionType ​
readonlyisDetectionType:false=false
multiProvider ​
readonlymultiProvider:true=true
properties ​
readonlyproperties:object
properties.current ​
readonlycurrent:object
properties.current.max? ​
optionalmax?:number
properties.current.min? ​
optionalmin?:number
properties.current.type ​
readonlytype:"number"='number'
properties.current.unit ​
unit:
string
properties.current.writable ​
readonlywritable:true=true
semantics ​
readonlysemantics:object
semantics.commandProperty ​
readonlycommandProperty:"current"='current'
semantics.deviceClass ​
deviceClass:
string
semantics.domain ​
readonlydomain:Measurement=SensorDomain.Measurement
semantics.stateProperty ​
readonlystateProperty:"current"='current'
semantics.unit ​
unit:
string
shortcutable ​
readonlyshortcutable:true=true
type ​
type:
T
virtual ​
readonlyvirtual:object
virtual.properties ​
readonlyproperties:object
virtual.properties.current ​
readonlycurrent:number=initial
Example ​
export const humidityMeta = defineMeasurement(SensorType.Humidity, 'humidity', {
unit: '%',
deviceClass: 'humidity',
initial: 50,
min: 0,
max: 100,
});