gobci

package module
v0.0.0-...-8ea6e2e Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2015 License: MIT Imports: 5 Imported by: 2

README

gobci

A package intended to use with the buffer_bci framework, to connect the hardware of your choice to your Go application.

Status

Currently it only receives data from the buffer server. There is no intention to build the sending part yet, because there is nothing useful to send (as we're not a hardware driver).

There's still some testing to be done, and there are no guarantees about the backwards compatibility just yet.

Examples

There is currently one example, that gathers all samples from the buffer server, and saving a plot of three sample channels to output.jpg. It is available in the examples directory.

There's a [blog post] that accompanies this repository.

Contributing

Contributions are very welcome. Just create an issue, work on it yourself (if you want), and create a PR.

If there haven't been a lot of commits, it's because I ran out of ideas to implement.

Documentation

Index

Constants

View Source
const (
	CommandPutHdr uint16 = 0x101
	CommandPutDat uint16 = 0x102
	CommandPutEvt uint16 = 0x103
	CommandPutOk  uint16 = 0x104
	CommandPutErr uint16 = 0x105

	CommandGetHdr uint16 = 0x201
	CommandGetDat uint16 = 0x202
	CommandGetOk  uint16 = 0x204
	CommandGetErr uint16 = 0x205

	CommandFlushDat uint16 = 0x302
	CommandFlushOk  uint16 = 0x304
	CommandFlushErr uint16 = 0x305

	CommandWaitDat uint16 = 0x402
	CommandWaitOk  uint16 = 0x404
	CommandWaitErr uint16 = 0x405
)
View Source
const (
	DataTypeChar uint32 = iota
	DataTypeUint8
	DataTypeUint16
	DataTypeuint32
	DataTypeUint64
	DataTypeInt8
	DataTypeInt16
	DataTypeInt32
	DataTypeInt64
	DataTypeFloat32
	DataTypeFloat64
)
View Source
const (
	DefaultHost = "localhost:1972"
)

Variables

View Source
var (
	ConnType  = "tcp"
	ByteOrder = binary.BigEndian
)

Functions

This section is empty.

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func Connect

func Connect(host string) (*Connection, error)

Connect attempts a connection to the Buffer Server at given host Host can be in the format of "localhost:1972", and may be empty to use the default hostname.

func (*Connection) Close

func (c *Connection) Close() error

Close closes the TCP connection with the host

func (*Connection) FlushData

func (c *Connection) FlushData() error

func (*Connection) GetData

func (c *Connection) GetData(begin, end uint32) ([][]float64, error)

GetData retrieves a 2d-array with sample data; one []float64 per sample

func (*Connection) GetHeader

func (c *Connection) GetHeader() (*Header, error)

GetHeader retrieves some useful meta-information from the current connection

func (*Connection) PutEvent

func (c *Connection) PutEvent(key, value string) error

func (*Connection) WaitData

func (c *Connection) WaitData(nSamples, nEvents, timeout uint32) (uint32, uint32, error)
type Header struct {
	NChannels         uint32  // number of channels
	NSamples          uint32  // number of samples, must be 0 for PUT_HDR
	NEvents           uint32  // number of events, must be 0 for PUT_HDR
	SamplingFrequency float32 // sampling frequency (Hz)
	// contains filtered or unexported fields
}

type HeaderChunk

type HeaderChunk struct {
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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