roomba_api

package module
v0.0.0-...-804a202 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2016 License: MIT Imports: 13 Imported by: 0

README

Roomba-API

A go-server which proveds RESTful-like HTTP API for controlling a roomba using go-roomba library from

Build Status Coverage Status

Documentation

Index

Constants

View Source
const (
	OPEN  operation = iota
	CLOSE operation = iota
)
View Source
const DUMMY_PORT_NAME string = "DummyPort"

Variables

This section is empty.

Functions

func NewTestClient

func NewTestClient(t *testing.T) *rpc.Client

func StartTestServer

func StartTestServer()

func StopTestServer

func StopTestServer()

Types

type AcquireConnectionRequest

type AcquireConnectionRequest struct {
	Port string `json:"port_name"`
}

type AcquireConnectionResponse

type AcquireConnectionResponse struct {
	Port string `json:"port_name"`
}

type Connection

type Connection struct {
	Port       Port
	Roomba     *roomba.Roomba
	NumClients uint8
}

type ConnectionRequest

type ConnectionRequest struct {
	Port      string
	Operation operation

	C chan<- ConnectionResponse
}

type ConnectionResponse

type ConnectionResponse struct {
	Error error
}

type DirectDriveRequest

type DirectDriveRequest struct {
	Port  string `json:"port_name"`
	Left  int16  `json:"left"`
	Right int16  `json:"right"`
}

type DirectDriveResponse

type DirectDriveResponse struct{}

type DriveRequest

type DriveRequest struct {
	Port     string `json:"port_name"`
	Velocity int16  `json:"velocity"`
	Radius   int16  `json:"radius"`
}

type DriveResponse

type DriveResponse struct{}

type GetPortsRequest

type GetPortsRequest struct{}

type GetPortsResponse

type GetPortsResponse struct {
	Ports []Port `json:"ports"`
}

type Port

type Port struct {
	Name string `json:"name"`
}

type ReleaseConnectionRequest

type ReleaseConnectionRequest struct {
	Port string `json:"port_name"`
}

type ReleaseConnectionResponse

type ReleaseConnectionResponse struct{}

type RoombaServer

type RoombaServer struct {
	Connections map[string]Connection
	// contains filtered or unexported fields
}

func MakeServer

func MakeServer() (s RoombaServer)

func (RoombaServer) AcquireConnection

func (server RoombaServer) AcquireConnection(req *AcquireConnectionRequest, resp *AcquireConnectionResponse) error

func (*RoombaServer) CloseConnection

func (server *RoombaServer) CloseConnection(port_name string) error

func (RoombaServer) DirectDrive

func (server RoombaServer) DirectDrive(req DirectDriveRequest, resp *DirectDriveResponse) error

func (RoombaServer) Drive

func (server RoombaServer) Drive(req DriveRequest, resp *DriveResponse) error

func (*RoombaServer) GetConnection

func (server *RoombaServer) GetConnection(port_name string) error

func (RoombaServer) GetPorts

func (server RoombaServer) GetPorts(req *GetPortsRequest, resp *GetPortsResponse) error

func (RoombaServer) ReleaseConnection

func (server RoombaServer) ReleaseConnection(req *ReleaseConnectionRequest, resp *ReleaseConnectionResponse) error

func (RoombaServer) Sensor

func (server RoombaServer) Sensor(req SensorRequest, resp *SensorResponse) error

func (RoombaServer) SensorList

func (server RoombaServer) SensorList(req *SensorListRequest, resp *SensorListResponse) error

type SensorListRequest

type SensorListRequest struct {
	Port      string `json:"port_name"`
	PacketIds []byte `json:"packet_ids"`
}

type SensorListResponse

type SensorListResponse struct {
	Values [][]byte `json:"values"`
}

type SensorRequest

type SensorRequest struct {
	Port     string `json:"port_name"`
	PacketId byte   `json:"packet_id"`
}

type SensorResponse

type SensorResponse struct {
	Value []byte `json:"value"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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