Documentation ¶
Index ¶
- type Client
- func (c *Client) GetDevice(deviceID string) (*Device, error)
- func (c *Client) GetDevices(dev GetDevicesStruct) ([]Device, error)
- func (c *Client) Login() error
- func (c *Client) RegisterDevice(imei string, timeoutV ...uint) (*RegistrationReply, error)
- func (c *Client) SetDeviceInfo(deviceID, name string) error
- func (c *Client) Subscribe(url string) (*Server, error)
- type Config
- type Device
- type DeviceData
- type DeviceDataChanged
- type DeviceInfo
- type GetDevicesStruct
- type Notification
- type NotificationFunc
- type OcTime
- type RegistrationReply
- type Server
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client struct that contains pointer to http client
func (*Client) GetDevices ¶
func (c *Client) GetDevices(dev GetDevicesStruct) ([]Device, error)
GetDevices returns struct with devices
func (*Client) RegisterDevice ¶
func (c *Client) RegisterDevice(imei string, timeoutV ...uint) (*RegistrationReply, error)
RegisterDevice registers a device with a corresponding IMEI number
func (*Client) SetDeviceInfo ¶
type Config ¶
type Config struct { CertFile string `yaml:"cert_file"` // CertFile is the path to the PEM client certificate CertKeyFile string `yaml:"key_file"` // CertKeyFile is the path to the PEM client certificate public key URL string `yaml:"url"` // URL where the Oceanconnect API is present AppID string `yaml:"app_id"` // AppID is the application Identifier Secret string `yaml:"secret"` ManufacturerName string `yaml:"manufacturer_name"` ManufacturerID string `yaml:"manufacturer_id"` EndUserID string `yaml:"end_user_id"` Location string `yaml:"location"` DeviceType string `yaml:"device_type"` Model string `yaml:"model"` }
Config struct for client configuration
type Device ¶
type Device struct { DeviceID string `json:"deviceId"` GatewayID string `json:"gatewayId"` NodeType string `json:"nodeType"` CreateTime OcTime `json:"creationTime"` LastModifiedTime OcTime `json:"lastModifiedTime"` DeviceInfo DeviceInfo `json:"deviceInfo"` Services []Service `json:"services"` // contains filtered or unexported fields }
Device struct with device data
func (*Device) GetHistoricalData ¶
func (d *Device) GetHistoricalData() ([]DeviceData, error)
GetHistoricalData returns data from specific device
type DeviceData ¶
type DeviceData struct { DeviceID string GatewayID string Appid string ServiceIS string Data []byte `json:"data"` Timestamp OcTime }
DeviceData struct with response data
func (*DeviceData) UnmarshalJSON ¶
func (u *DeviceData) UnmarshalJSON(data []byte) error
type DeviceDataChanged ¶
type DeviceDataChanged struct { DeviceID string GatewayID string RequestID string Service Service `json:"service"` }
DeviceDataChanged struct with device data
type DeviceInfo ¶
type DeviceInfo struct { NodeID string Name string Description string ManufacturerID string ManufacturerName string Mac string Location string DeviceType string Model string Swversion string FwVersion string HwVersion string ProtocolType string BridgeID string Status string StatusDetail string Mute string SupportedSecurity string IsSecurity string SignalStrength string SigVersion string SerialNumber string }
DeviceInfo struct with device info data
type GetDevicesStruct ¶
type GetDevicesStruct struct { GatewayID string NodeType string PageNo int PageSize int Status string StartTime string EndTime string Sort string }
GetDevicesStruct struct for function GetDevices
type Notification ¶
type Notification string
const ( // NotificationDeviceAdded is used to notify initial device logins. // When a device registers with the OceanConnect (the device creates messages on // the OceanConnect and obtains the password), the OceanConnect sends a // notification to the application or a new device is added to the gateway, the // OceanConnect invokes this interface to send a notification to the application. NotificationDeviceAdded Notification = "deviceAdded" // NotificationDeviceInfoChanged is used after receiving device information changes // (changes of static information such as the device name and manufacturer ID). NotificationDeviceInfoChanged Notification = "deviceInfoChanged" // NotificationDeviceDataChanged is used after receiving device data changes // (dynamic changes such as changes of service attribute values). NotificationDeviceDataChanged Notification = "deviceDataChanged" // NotificationDeviceDeleted is used when learning that a // non-directly-connected device is deleted NotificationDeviceDeleted Notification = "deviceDeleted" // NotificationMessageConfirm is used after receiving an acknowledgment // message from the gateway, for example, the OceanConnect sends a command // to the gateway and the gateway acknowledges the message. NotificationMessageConfirm Notification = "messageConfirm" // NotificationCommandResponse is used after receiving a response command // from a device (gateway or common device), for example, the OceanConnect sends a // command to the device and the device returns a response command after running the // command, such as video call, video recording, and screenshot NotificationCommandResponse Notification = "commandRsp" // NotificationDeviceEvent after receiving an event (for example, insufficient // UDS storage space) from a device NotificationDeviceEvent Notification = "deviceEvent" // NotificationServiceInfoChanged is sent when learning device service information // changes, the OceanConnect invokes this interface to send a notification to the // application. NotificationServiceInfoChanged Notification = "serviceInfoChanged" // NotificationRuleEvent is used when generates the corresponding rule event // notification to NA when the rule is triggered NotificationRuleEvent Notification = "ruleEvent" )
type NotificationFunc ¶
type NotificationFunc func(interface{}) error
type OcTime ¶
OcTime is used for unmarshalling the times communicated via the API to time.Time
func (*OcTime) UnmarshalJSON ¶
UnmarshalJSON reads the times to time.Time
type RegistrationReply ¶
type RegistrationReply struct { VerifyCode string `json:"verifyCode"` DeviceID string `json:"deviceId"` Timeout uint `json:"timeout"` Psk string `json:"psk"` }
RegistrationReply for RegisterDevice
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ListenAndServe ¶
func (*Server) RegisterCallback ¶
func (s *Server) RegisterCallback(not Notification, cb NotificationFunc)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.