Documentation
¶
Index ¶
- func NewAppHandler(db *db.Db, influx *db.Influx, getAsset func(string) []byte, ...) http.Handler
- func NewDevicesHandler(db *db.Db, influx *db.Influx) http.Handler
- func NewGetCmd(portalURL, deviceID string, timeout time.Duration, debug bool) func() (data.DeviceCmd, error)
- func NewIndexHandler(getAsset func(string) []byte) http.Handler
- func NewSendSamples(portalURL, deviceID string, timeout time.Duration, debug bool) func([]data.Sample) error
- func NewSetVersion(portalURL, deviceID string, timeout time.Duration, debug bool) func(ver data.DeviceVersion) error
- func NewV1Handler(db *db.Db, influx *db.Influx) http.Handler
- func NewWebsocketHandler(wsTx <-chan []byte, wsRx chan<- []byte, newConn chan<- bool) http.Handler
- func Server(port string, dbInst *db.Db, influx *db.Influx, getAsset func(string) []byte, ...) error
- func ShiftPath(p string) (head, tail string)
- type App
- type CoapServer
- type Devices
- type IndexHandler
- type V1
- type WebsocketHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAppHandler ¶
func NewAppHandler(db *db.Db, influx *db.Influx, getAsset func(string) []byte, filesystem http.FileSystem, debug bool) http.Handler
NewAppHandler returns a new application (root) http handler
func NewDevicesHandler ¶
NewDevicesHandler returns a new device handler
func NewGetCmd ¶
func NewGetCmd(portalURL, deviceID string, timeout time.Duration, debug bool) func() (data.DeviceCmd, error)
NewGetCmd returns a function that can be used to get device commands from the portal.
func NewIndexHandler ¶
NewIndexHandler returns a new Index handler
func NewSendSamples ¶
func NewSendSamples(portalURL, deviceID string, timeout time.Duration, debug bool) func([]data.Sample) error
NewSendSamples returns a function that can be used to send samples to a SimpleIoT portal instance
func NewSetVersion ¶
func NewSetVersion(portalURL, deviceID string, timeout time.Duration, debug bool) func(ver data.DeviceVersion) error
NewSetVersion sets the device version in the portal
func NewV1Handler ¶
NewV1Handler returns a handle for V1 API
func NewWebsocketHandler ¶
NewWebsocketHandler returns a new websocket handler. The wsTx channel is used to send data out the websocket, and the newConn channel is used to signal back to the caller that a new client has connected, and the initial data set needs to be sent over.
Types ¶
type App ¶
type App struct {
PublicHandler http.Handler
IndexHandler http.Handler
V1ApiHandler http.Handler
Debug bool
}
App is a struct that implements http.Handler interface
type CoapServer ¶
type CoapServer struct {
// contains filtered or unexported fields
}
CoapServer manages all the coap requests for this platform
func NewCoapServer ¶
func NewCoapServer(port string) *CoapServer
NewCoapServer creates a new coap server
type Devices ¶
type Devices struct {
// contains filtered or unexported fields
}
Devices handles device requests
type IndexHandler ¶
type IndexHandler struct {
// contains filtered or unexported fields
}
IndexHandler is used to serve the index page
func (*IndexHandler) ServeHTTP ¶
func (h *IndexHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type WebsocketHandler ¶
type WebsocketHandler struct {
// contains filtered or unexported fields
}
WebsocketHandler handles websocket connections
func (*WebsocketHandler) ServeHTTP ¶
func (h *WebsocketHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)