jsonrpc

package
v0.0.0-...-de2618e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoPersonality = "NONE"
)
View Source
const (
	RpcVersion = "2.0"
)

Variables

View Source
var (
	//ErrInvalidVersion error returned when JsonRpc version is not 2.0
	ErrInvalidVersion = errors.New("invalid jsonrpc version")
	//ErrMissingMethod error returned when method field is missing or empty
	ErrMissingMethod = errors.New("missing or empty method field")
	//ErrMissingId error returned when id field is missing or empty
	ErrMissingId = errors.New("missing or empty id field")
)

Functions

func Decode

func Decode(value string, js Message, errorGauge *metrics.Gauge) error

Types

type ControllerStatusUpdate

type ControllerStatusUpdate struct {
	Notification
	Params ControllerStatusUpdateParams `json:"params"`
}

func (*ControllerStatusUpdate) Validate

func (notif *ControllerStatusUpdate) Validate() error

type ControllerStatusUpdateParams

type ControllerStatusUpdateParams struct {
	DeviceId string `json:"device_id"`
	Status   string `json:"status"`
}

type GpsLocation

type GpsLocation struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Altitude  float64 `json:"altitude"`
}

type Heartbeat

type Heartbeat struct {
	Notification                 // embed
	Params       HeartbeatParams `json:"params"`
}

func (*Heartbeat) Validate

func (hb *Heartbeat) Validate() error

type HeartbeatParams

type HeartbeatParams struct {
	SentOn   int64  `json:"sent_on"`
	DeviceId string `json:"device_id"`
}

type InventoryData

type InventoryData struct {
	Notification                     // embed
	Params       InventoryDataParams `json:"params"`
}

func (*InventoryData) Validate

func (data *InventoryData) Validate() error

type InventoryDataParams

type InventoryDataParams struct {
	SentOn         int64       `json:"sent_on"`
	Period         int         `json:"period"`
	DeviceId       string      `json:"device_id"`
	Location       GpsLocation `json:"location"`
	FacilityId     string      `json:"facility_id"`
	MotionDetected bool        `json:"motion_detected"`
	Data           []TagRead   `json:"data"`
}

type InventoryEvent

type InventoryEvent struct {
	Notification                      // embed
	Params       InventoryEventParams `json:"params"`
}

func NewInventoryEvent

func NewInventoryEvent() *InventoryEvent

func (*InventoryEvent) AddTagEvent

func (invEvent *InventoryEvent) AddTagEvent(event TagEvent)

func (*InventoryEvent) IsEmpty

func (invEvent *InventoryEvent) IsEmpty() bool

func (*InventoryEvent) Validate

func (invEvent *InventoryEvent) Validate() error

type InventoryEventParams

type InventoryEventParams struct {
	SentOn       int64      `json:"sent_on"`
	ControllerId string     `json:"controller_id,omitempty"` // ok to be empty for handheld
	Data         []TagEvent `json:"data"`
}

type Message

type Message interface {
	Validate() error
}

type Notification

type Notification struct {
	Version string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"`
}

func (*Notification) Validate

func (js *Notification) Validate() error

type Request

type Request struct {
	Notification        // embed
	Id           string `json:"id"`
}

func (*Request) Validate

func (js *Request) Validate() error

type SchedulerRunState

type SchedulerRunState struct {
	Notification
	Params SchedulerRunStateParams `json:"params"`
}

func (*SchedulerRunState) Validate

func (notif *SchedulerRunState) Validate() error

type SchedulerRunStateParams

type SchedulerRunStateParams struct {
	RunState string `json:"run_state"`
}

type SensorBasicInfo

type SensorBasicInfo struct {
	DeviceId        string          `json:"device_id"`
	ConnectionState string          `json:"connection_state"`
	ReadState       string          `json:"read_state"`
	BehaviorId      string          `json:"behavior_id"`
	FacilityId      string          `json:"facility_id"`
	Personality     string          `json:"personality"`
	Aliases         []string        `json:"aliases"`
	Alerts          json.RawMessage `json:"alerts"`
}

func (*SensorBasicInfo) Validate

func (info *SensorBasicInfo) Validate() error

type SensorConfigNotification

type SensorConfigNotification struct {
	Notification
	Params SensorConfigNotificationParams `json:"params"`
}

func (*SensorConfigNotification) Validate

func (notif *SensorConfigNotification) Validate() error

type SensorConfigNotificationParams

type SensorConfigNotificationParams struct {
	DeviceId    string   `json:"device_id"`
	FacilityId  string   `json:"facility_id"`
	Personality string   `json:"personality"`
	Aliases     []string `json:"aliases"`
}

type SensorDeviceIdsResponse

type SensorDeviceIdsResponse []string

func (*SensorDeviceIdsResponse) Validate

func (info *SensorDeviceIdsResponse) Validate() error

implement the jsonrpc.Message interface

type TagEvent

type TagEvent struct {
	EpcCode         string `json:"epc_code"`
	Tid             string `json:"tid"`
	EpcEncodeFormat string `json:"epc_encode_format"`
	FacilityID      string `json:"facility_id"`
	Location        string `json:"location"`
	EventType       string `json:"event_type,omitempty"`
	Timestamp       int64  `json:"timestamp"`
}

TagEvent is the model of the tag event received from RSP Controller

type TagRead

type TagRead struct {
	Epc        string `json:"epc"`
	Tid        string `json:"tid"`
	AntennaId  int    `json:"antenna_id"`
	LastReadOn int64  `json:"last_read_on"`
	Rssi       int    `json:"rssi"`
	Phase      int    `json:"phase"`
	Frequency  int    `json:"frequency"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL