irkit

package
v0.0.0-...-9a20793 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package irkit is the unofficial golang client for IRKit, http://getirkit.com/en/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InternetClient

type InternetClient struct {
	URL *url.URL
	// contains filtered or unexported fields
}

InternetClient is client for IRKit Internet HTTP API. https://api.getirkit.com

func DefaultInternetClient

func DefaultInternetClient() *InternetClient

DefaultInternetClient creates InternetClient with default API endpoint.

func (*InternetClient) GetDevices

func (c *InternetClient) GetDevices(ctx context.Context,
	clientkey string) (devicekey, deviceid string, err error)

GetDevices gets devicekey and deviceid

func (*InternetClient) GetKeys

func (c *InternetClient) GetKeys(ctx context.Context,
	token string) (deviceid, clientkey string, err error)

GetKeys gets deviceid and clientkey.

func (*InternetClient) GetMessages

func (c *InternetClient) GetMessages(ctx context.Context,
	clientkey string, clear bool) (*SignalInfo, error)

GetMessages gets latest received IR signal. This request is a long pooling request.

If you provide clear=true, it it clears IR signal buffer on server on internet. When IRKit device receives an IR signal, device sends it over to our server on Internet, and server passes it over as response.

Server will respond with an empty response after timeout.

func (*InternetClient) SendMessages

func (c *InternetClient) SendMessages(ctx context.Context,
	clientkey, deviceid string, msg *Message) error

SendMessages sends IR signal through IRKit device identified by deviceid.

type Message

type Message struct {
	// Format is format of signal. "raw" only.
	Format string `json:"format"`

	// Freq is IRKit sub-carrier frequency. 38 or 40 only. [kHz]
	Freq int `json:"freq"`

	// Data is IRkit signal consists of ON/OFF of sub carrier frequency.
	// IRKit measures On to Off, Off to On interval using a 2MHz counter.
	// data value is an array of those intervals
	Data []int `json:"data"`
}

Message represents IRKit signal message.

type SignalInfo

type SignalInfo struct {
	// Hostname is IRKit device hostname.
	Hostname string `json:"hostname"`

	// Deviceid is IRKit device identifier.
	Deviceid string `json:"deviceid"`

	// Message is IRKit signal message.
	Message Message `json:"message"`
}

SignalInfo represetns IRKit signal infomation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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