Documentation ¶
Index ¶
- Constants
- type AsyncValues
- type CommandRequest
- type CommandValue
- func (cv *CommandValue) BinaryValue() ([]byte, error)
- func (cv *CommandValue) BoolArrayValue() ([]bool, error)
- func (cv *CommandValue) BoolValue() (bool, error)
- func (cv *CommandValue) Float32ArrayValue() ([]float32, error)
- func (cv *CommandValue) Float32Value() (float32, error)
- func (cv *CommandValue) Float64ArrayValue() ([]float64, error)
- func (cv *CommandValue) Float64Value() (float64, error)
- func (cv *CommandValue) Int16ArrayValue() ([]int16, error)
- func (cv *CommandValue) Int16Value() (int16, error)
- func (cv *CommandValue) Int32ArrayValue() ([]int32, error)
- func (cv *CommandValue) Int32Value() (int32, error)
- func (cv *CommandValue) Int64ArrayValue() ([]int64, error)
- func (cv *CommandValue) Int64Value() (int64, error)
- func (cv *CommandValue) Int8ArrayValue() ([]int8, error)
- func (cv *CommandValue) Int8Value() (int8, error)
- func (cv *CommandValue) ObjectValue() (interface{}, error)
- func (cv *CommandValue) String() string
- func (cv *CommandValue) StringArrayValue() ([]string, error)
- func (cv *CommandValue) StringValue() (string, error)
- func (cv *CommandValue) Uint16ArrayValue() ([]uint16, error)
- func (cv *CommandValue) Uint16Value() (uint16, error)
- func (cv *CommandValue) Uint32ArrayValue() ([]uint32, error)
- func (cv *CommandValue) Uint32Value() (uint32, error)
- func (cv *CommandValue) Uint64ArrayValue() ([]uint64, error)
- func (cv *CommandValue) Uint64Value() (uint64, error)
- func (cv *CommandValue) Uint8ArrayValue() ([]uint8, error)
- func (cv *CommandValue) Uint8Value() (uint8, error)
- func (cv *CommandValue) ValueToString() string
- type DeviceDiscoveryProgress
- type DiscoveredDevice
- type Progress
Constants ¶
const ( // Policy limits should be located in global config namespace // Currently assigning 16MB (binary), 16 * 2^20 bytes MaxBinaryBytes = 16777216 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncValues ¶
type AsyncValues struct { DeviceName string SourceName string CommandValues []*CommandValue }
AsyncValues is the struct for sending Device readings asynchronously via ProtocolDrivers
type CommandRequest ¶
type CommandRequest struct { // DeviceResourceName is the name of Device Resource for this command DeviceResourceName string // Attributes is a key/value map to represent the attributes of the Device Resource Attributes map[string]interface{} // Type is the data type of the Device Resource Type string }
CommandRequest is the struct for requesting a command to ProtocolDrivers
type CommandValue ¶
type CommandValue struct { // DeviceResourceName is the name of Device Resource for this command DeviceResourceName string // Type indicates what type of value was returned from the ProtocolDriver instance in // response to HandleCommand being called to handle a single ResourceOperation. Type string // Value holds value returned by a ProtocolDriver instance. // The value can be converted to its native type by referring to ValueType. Value interface{} // Origin is an int64 value which indicates the time the reading // contained in the CommandValue was read by the ProtocolDriver // instance. Origin int64 // Tags allows device service to add custom information to the Event in order to // help identify its origin or otherwise label it before it is send to north side. Tags map[string]string }
CommandValue is the struct to represent the reading value of a Get command coming from ProtocolDrivers or the parameter of a Put command sending to ProtocolDrivers.
func NewCommandValue ¶
func NewCommandValue(deviceResourceName string, valueType string, value interface{}) (*CommandValue, error)
NewCommandValue create a CommandValue according to the valueType supplied.
func NewCommandValueWithOrigin ¶
func NewCommandValueWithOrigin(deviceResourceName string, valueType string, value interface{}, origin int64) (*CommandValue, error)
NewCommandValueWithOrigin wraps NewCommandValue, create a CommandValue and add the Origin field.
func (*CommandValue) BinaryValue ¶
func (cv *CommandValue) BinaryValue() ([]byte, error)
BinaryValue returns the value in []byte data type, and returns error if the Type is not Binary.
func (*CommandValue) BoolArrayValue ¶
func (cv *CommandValue) BoolArrayValue() ([]bool, error)
BoolArrayValue returns the value in an array of bool type, and returns error if the Type is not BoolArray.
func (*CommandValue) BoolValue ¶
func (cv *CommandValue) BoolValue() (bool, error)
BoolValue returns the value in bool data type, and returns error if the Type is not Bool.
func (*CommandValue) Float32ArrayValue ¶
func (cv *CommandValue) Float32ArrayValue() ([]float32, error)
Float32ArrayValue returns the value in an array of float32 type, and returns error if the Type is not Float32Array.
func (*CommandValue) Float32Value ¶
func (cv *CommandValue) Float32Value() (float32, error)
Float32Value returns the value in float32 data type, and returns error if the Type is not Float32.
func (*CommandValue) Float64ArrayValue ¶
func (cv *CommandValue) Float64ArrayValue() ([]float64, error)
Float64ArrayValue returns the value in an array of float64 type, and returns error if the Type is not Float64Array.
func (*CommandValue) Float64Value ¶
func (cv *CommandValue) Float64Value() (float64, error)
Float64Value returns the value in float64 data type, and returns error if the Type is not Float64.
func (*CommandValue) Int16ArrayValue ¶
func (cv *CommandValue) Int16ArrayValue() ([]int16, error)
Int16ArrayValue returns the value in an array of int16 type, and returns error if the Type is not Int16Array.
func (*CommandValue) Int16Value ¶
func (cv *CommandValue) Int16Value() (int16, error)
Int16Value returns the value in int16 data type, and returns error if the Type is not Int16.
func (*CommandValue) Int32ArrayValue ¶
func (cv *CommandValue) Int32ArrayValue() ([]int32, error)
Int32ArrayValue returns the value in an array of int32 type, and returns error if the Type is not Int32Array.
func (*CommandValue) Int32Value ¶
func (cv *CommandValue) Int32Value() (int32, error)
Int32Value returns the value in int32 data type, and returns error if the Type is not Int32.
func (*CommandValue) Int64ArrayValue ¶
func (cv *CommandValue) Int64ArrayValue() ([]int64, error)
Int64ArrayValue returns the value in an array of int64 type, and returns error if the Type is not Int64Array.
func (*CommandValue) Int64Value ¶
func (cv *CommandValue) Int64Value() (int64, error)
Int64Value returns the value in int64 data type, and returns error if the Type is not Int64.
func (*CommandValue) Int8ArrayValue ¶
func (cv *CommandValue) Int8ArrayValue() ([]int8, error)
Int8ArrayValue returns the value in an array of int8 type, and returns error if the Type is not Int8Array.
func (*CommandValue) Int8Value ¶
func (cv *CommandValue) Int8Value() (int8, error)
Int8Value returns the value in int8 data type, and returns error if the Type is not Int8.
func (*CommandValue) ObjectValue ¶
func (cv *CommandValue) ObjectValue() (interface{}, error)
ObjectValue returns the value in object data type, and returns error if the Type is not Object.
func (*CommandValue) String ¶
func (cv *CommandValue) String() string
String returns a string representation of a CommandValue instance.
func (*CommandValue) StringArrayValue ¶
func (cv *CommandValue) StringArrayValue() ([]string, error)
StringArrayValue returns the value in an array of bool type, and returns error if the Type is not BoolArray.
func (*CommandValue) StringValue ¶
func (cv *CommandValue) StringValue() (string, error)
StringValue returns the value in string data type, and returns error if the Type is not String.
func (*CommandValue) Uint16ArrayValue ¶
func (cv *CommandValue) Uint16ArrayValue() ([]uint16, error)
Uint16ArrayValue returns the value in an array of uint16 type, and returns error if the Type is not Uint16Array.
func (*CommandValue) Uint16Value ¶
func (cv *CommandValue) Uint16Value() (uint16, error)
Uint16Value returns the value in uint16 data type, and returns error if the Type is not Uint16.
func (*CommandValue) Uint32ArrayValue ¶
func (cv *CommandValue) Uint32ArrayValue() ([]uint32, error)
Uint32ArrayValue returns the value in an array of uint32 type, and returns error if the Type is not Uint32Array.
func (*CommandValue) Uint32Value ¶
func (cv *CommandValue) Uint32Value() (uint32, error)
Uint32Value returns the value in uint32 data type, and returns error if the Type is not Uint32.
func (*CommandValue) Uint64ArrayValue ¶
func (cv *CommandValue) Uint64ArrayValue() ([]uint64, error)
Uint64ArrayValue returns the value in an array of uint64 type, and returns error if the Type is not Uint64Array.
func (*CommandValue) Uint64Value ¶
func (cv *CommandValue) Uint64Value() (uint64, error)
Uint64Value returns the value in uint64 data type, and returns error if the Type is not Uint64.
func (*CommandValue) Uint8ArrayValue ¶
func (cv *CommandValue) Uint8ArrayValue() ([]uint8, error)
Uint8ArrayValue returns the value in an array of uint8 type, and returns error if the Type is not Uint8Array.
func (*CommandValue) Uint8Value ¶
func (cv *CommandValue) Uint8Value() (uint8, error)
Uint8Value returns the value in uint8 data type, and returns error if the Type is not Uint8.
func (*CommandValue) ValueToString ¶
func (cv *CommandValue) ValueToString() string
ValueToString returns the string format of the value.
type DeviceDiscoveryProgress ¶
type DiscoveredDevice ¶
type DiscoveredDevice struct { Name string Protocols map[string]models.ProtocolProperties Description string Labels []string }
DiscoveredDevice defines the required information for a found device.