gakisitor

command module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2018 License: MIT Imports: 4 Imported by: 0

README

GAkisitor (SportsFun)

Version License GoDoc Build Status Codacy Badge Codacy Badge

GAkisitor is a Go service for connecting sports equipment to a SportsFun game session

Features

  • Connect sport equipments to a SportsFun play session
  • Easily expandable thanks to the module mechanism
  • Automatic reload service when the configuration file is modified
  • Works on different embedded systems

Module mechanism

Module ... Vas is das ?

A module is a sort of package combining one (or more) metric sensor(s) with a plugin

  • The metric sensors get data from the player activity, like his speed.
    However, to be compatible with the host, this physical part must respect some restriction (defined by the host's conceptor).
  • The plugin is a sort of driver, converting metric datas to usable data.
How to develop a module ?

To develop a plugin, you must implement Module.

1. Module management

The first method called by the GAkisitor is Start. It implements all things that must be instantied at first.

Start(*NotificationQueue, log.Logger) error
Parameters
  • NotificationQueue : instance used to notify information to the server
  • log.Logger : logger instance, used for logging information
Error management
  • If an error occurs, you need to return an error and set the Panic state (see example)

In contrast, the last method called before module shutdown is Stop. It close, defer, kill, eat, ... all values to stop cleanly the module. If a session is running, don't forget to close it (StopSession).

Stop() error
Error management
  • If an error occurs, you need to return an error and set the Panic state.
2. Module configuration

Just after calling Start, the module must be configured with Configure

Configure(properties.ModuleDefinition) error
Parameters
  • ModuleDefinition : struct representing the module definition (module name, plugin path and configuration, throw an interface{}).
Error management
  • If an error occurs, you need to return an error and set the Panic state.
3. Session management

A session represents a game session. To reduce consumption (and because it's useless), the sensors must be active only during a session. Moreover, sensors data getting must be asynchronous and therefore started in a goroutine.

Like Start, to start a session, you must implement StartSession.

StartSession() error
Error management
  • If an error occurs, you need to return an error and set the Idle state. Don't forget to close the goroutine if it launched. If the error is really critical, set the Panic state.

To stop a session, you must implement StopSession. You must close the goroutine here.

StopSession() error
Error management
  • If an error occurs, you need to return an error and set the Idle state. Don't forget to close the goroutine if it launched. If the error is really critical, set the Panic state.
4. Processing

To convert sensors data and send them to the server, a Process method is required.

Process() error
Error management
  • If an error occurs, you need to return an error. If the error is really critical, set the Panic state.
5. Properties

Some properties must be implemented to get some information about the module.

Name() string           // Return the module name
State() types.StateType // Return the current module state

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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