Documentation
¶
Index ¶
Constants ¶
const ( Version = "2.0" RSPControllerSubscribeMethod = "subscribe" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceIdParams ¶
type DeviceIdParams struct {
DeviceId string `json:"device_id"`
}
DeviceIdParams holds the device id parameter used in command requests to RSP Controller
type Notification ¶
type Notification struct {
Version string `json:"jsonrpc"`
Method string `json:"method"`
Params Parameters `json:"params,omitempty"`
}
Notification represents a JsonRPC 2.0 Notification
func (*Notification) GetParam ¶
func (n *Notification) GetParam(key string, out interface{}) error
GetParam looks for the parameter 'key' and unmarshals it into `out`. If the key is not in the parameters, the Notification has no parameters, or the value cannot be unmarshaled into out, this returns an error.
func (*Notification) SetParam ¶
func (n *Notification) SetParam(key string, v interface{}) error
SetParam sets the value of the parameter 'key' to the marshaled result of v. If 'key' already exists, it's overwritten. If the Notification doesn't have parameters, a new set is created for it.
type Parameters ¶
type Parameters map[string]json.RawMessage
func (Parameters) Get ¶
func (p Parameters) Get(key string, out interface{}) error
Get unmarshals the parameter 'key' into out. Returns an error if the key doesn't exist or fails to unmarshal into out.
func (Parameters) Set ¶
func (p Parameters) Set(key string, v interface{}) error
Sets the value of the parameter 'key' to the marshaled value of v. If the key exists, it's overwritten. If it fails to marshal, this returns an error.
type RSPCommandRequest ¶
type RSPCommandRequest struct {
Request // embed
Params DeviceIdParams `json:"params"`
}
func NewRSPCommandRequest ¶
func NewRSPCommandRequest(method string, deviceId string) RSPCommandRequest
type RSPControllerSubscribeRequest ¶
func NewRSPControllerSubscribeRequest ¶
func NewRSPControllerSubscribeRequest(topics []string) RSPControllerSubscribeRequest
type Request ¶
type Request struct {
Version string `json:"jsonrpc"`
Id string `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}
Request represents a JsonRPC 2.0 Request
func NewRequest ¶
type Response ¶
type Response struct {
Version string `json:"jsonrpc"`
Id string `json:"id"`
Result json.RawMessage `json:"result"`
Error json.RawMessage `json:"error"`
}
Response represents a JsonRPC 2.0 Response