Skip to content

Commit

Permalink
core: Ensure that all drivers have default names
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <ron@hybridgroup.com>
  • Loading branch information
deadprogram committed Oct 3, 2016
1 parent acfdbee commit 07f6749
Show file tree
Hide file tree
Showing 48 changed files with 50 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/gpio/analog_sensor_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type AnalogSensorDriver struct {
// "Read" - See AnalogSensor.Read
func NewAnalogSensorDriver(a AnalogReader, pin string, v ...time.Duration) *AnalogSensorDriver {
d := &AnalogSensorDriver{
name: "Analog Sensor",
connection: a,
pin: pin,
Eventer: gobot.NewEventer(),
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/button_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type ButtonDriver struct {
// time.Duration: Interval at which the ButtonDriver is polled for new information
func NewButtonDriver(a DigitalReader, pin string, v ...time.Duration) *ButtonDriver {
b := &ButtonDriver{
name: "Button",
connection: a,
pin: pin,
Active: false,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/buzzer_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ type BuzzerDriver struct {
// NewBuzzerDriver return a new BuzzerDriver given a DigitalWriter and pin.
func NewBuzzerDriver(a DigitalWriter, pin string) *BuzzerDriver {
l := &BuzzerDriver{
name: "Buzzer",
pin: pin,
connection: a,
high: false,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/direct_pin_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type DirectPinDriver struct {
// "ServoWrite" - See DirectPinDriver.ServoWrite
func NewDirectPinDriver(a gobot.Connection, pin string) *DirectPinDriver {
d := &DirectPinDriver{
name: "Direct Pin",
connection: a,
pin: pin,
Commander: gobot.NewCommander(),
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/led_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type LedDriver struct {
// "Off" - See LedDriver.Off
func NewLedDriver(a DigitalWriter, pin string) *LedDriver {
l := &LedDriver{
name: "LED",
pin: pin,
connection: a,
high: false,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/makey_button_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type MakeyButtonDriver struct {
// time.Duration: Interval at which the ButtonDriver is polled for new information
func NewMakeyButtonDriver(a DigitalReader, pin string, v ...time.Duration) *MakeyButtonDriver {
m := &MakeyButtonDriver{
name: "Makey Button",
connection: a,
pin: pin,
Active: false,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/motor_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type MotorDriver struct {
// NewMotorDriver return a new MotorDriver given a DigitalWriter and pin
func NewMotorDriver(a DigitalWriter, speedPin string) *MotorDriver {
return &MotorDriver{
name: "Motor",
connection: a,
SpeedPin: speedPin,
CurrentState: 0,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/relay_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type RelayDriver struct {
// "Off" - See RelayDriver.Off
func NewRelayDriver(a DigitalWriter, pin string) *RelayDriver {
l := &RelayDriver{
name: "Relay",
pin: pin,
connection: a,
high: false,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/rgb_led_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type RgbLedDriver struct {
// "Off" - See RgbLedDriver.Off
func NewRgbLedDriver(a DigitalWriter, redPin string, greenPin string, bluePin string) *RgbLedDriver {
l := &RgbLedDriver{
name: "RGB LED",
pinRed: redPin,
pinGreen: greenPin,
pinBlue: bluePin,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/servo_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type ServoDriver struct {
// "Max" - See ServoDriver.Max
func NewServoDriver(a ServoWriter, pin string) *ServoDriver {
s := &ServoDriver{
name: "Servo",
connection: a,
pin: pin,
Commander: gobot.NewCommander(),
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/blinkm_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type BlinkMDriver struct {
// Color - returns the color of the LED.
func NewBlinkMDriver(a I2c) *BlinkMDriver {
b := &BlinkMDriver{
name: "BlinkM",
connection: a,
Commander: gobot.NewCommander(),
}
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/hmc6352_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type HMC6352Driver struct {
// NewHMC6352Driver creates a new driver with specified i2c interface
func NewHMC6352Driver(a I2c) *HMC6352Driver {
return &HMC6352Driver{
name: "HMC6352",
connection: a,
}
}
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/jhd1313m1_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type JHD1313M1Driver struct {
// NewJHD1313M1Driver creates a new driver with specified i2c interface.
func NewJHD1313M1Driver(a I2c) *JHD1313M1Driver {
return &JHD1313M1Driver{
name: "JHD1313M1",
connection: a,
lcdAddress: 0x3E,
rgbAddress: 0x62,
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/lidarlite_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type LIDARLiteDriver struct {
// NewLIDARLiteDriver creates a new driver with specified i2c interface
func NewLIDARLiteDriver(a I2c) *LIDARLiteDriver {
return &LIDARLiteDriver{
name: "LIDARLite",
connection: a,
}
}
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/mcp23017_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ type MCP23017Driver struct {
// NewMCP23017Driver creates a new driver with specified i2c interface.
func NewMCP23017Driver(a I2c, conf MCP23017Config, deviceAddress int, v ...time.Duration) *MCP23017Driver {
m := &MCP23017Driver{
name: "MCP23017",
connection: a,
conf: conf,
mcp23017Address: deviceAddress,
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/mpl115a2_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type MPL115A2Driver struct {
// NewMPL115A2Driver creates a new driver with specified i2c interface
func NewMPL115A2Driver(a I2c, v ...time.Duration) *MPL115A2Driver {
m := &MPL115A2Driver{
name: "MPL115A2",
connection: a,
Eventer: gobot.NewEventer(),
interval: 10 * time.Millisecond,
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/mpu6050_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type MPU6050Driver struct {
// NewMPU6050Driver creates a new driver with specified i2c interface
func NewMPU6050Driver(a I2c, v ...time.Duration) *MPU6050Driver {
m := &MPU6050Driver{
name: "MPU6050",
connection: a,
interval: 10 * time.Millisecond,
Eventer: gobot.NewEventer(),
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/wiichuck_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type WiichuckDriver struct {
// "error" - Gets triggered whenever the WiichuckDriver encounters an error
func NewWiichuckDriver(a I2c, v ...time.Duration) *WiichuckDriver {
w := &WiichuckDriver{
name: "Wiichuck",
connection: a,
interval: 10 * time.Millisecond,
pauseTime: 1 * time.Millisecond,
Expand Down
1 change: 1 addition & 0 deletions platforms/ardrone/ardrone_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Adaptor struct {
//
func NewAdaptor(v ...string) *Adaptor {
a := &Adaptor{
name: "ARDrone",
connect: func(a *Adaptor) (drone, error) {
return client.Connect(a.config)
},
Expand Down
1 change: 1 addition & 0 deletions platforms/ardrone/ardrone_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Driver struct {
// 'flying' - Sent when the device has taken off.
func NewDriver(connection *Adaptor) *Driver {
d := &Driver{
name: "ARDrone",
connection: connection,
Eventer: gobot.NewEventer(),
}
Expand Down
2 changes: 1 addition & 1 deletion platforms/audio/audio_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Adaptor struct {
}

func NewAdaptor() *Adaptor {
return &Adaptor{}
return &Adaptor{name: "Audio"}
}

func (a *Adaptor) Name() string { return a.name }
Expand Down
1 change: 1 addition & 0 deletions platforms/audio/audio_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Driver struct {

func NewDriver(a *Adaptor, filename string) *Driver {
d := &Driver{
name: "Audio",
connection: a,
interval: 500 * time.Millisecond,
filename: filename,
Expand Down
1 change: 1 addition & 0 deletions platforms/beaglebone/beaglebone_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ type Adaptor struct {
// NewAdaptor returns a new Beaglebone Adaptor
func NewAdaptor() *Adaptor {
b := &Adaptor{
name: "Beaglebone",
digitalPins: make([]sysfs.DigitalPin, 120),
pwmPins: make(map[string]*pwmPin),
}
Expand Down
1 change: 1 addition & 0 deletions platforms/bebop/bebop_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Adaptor struct {
// NewAdaptor returns a new BebopAdaptor
func NewAdaptor() *Adaptor {
return &Adaptor{
name: "Bebop",
drone: client.New(),
connect: func(a *Adaptor) error {
return a.drone.Connect()
Expand Down
1 change: 1 addition & 0 deletions platforms/bebop/bebop_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Driver struct {
// NewDriver creates an Bebop Driver.
func NewDriver(connection *Adaptor) *Driver {
d := &Driver{
name: "Bebop",
connection: connection,
Eventer: gobot.NewEventer(),
}
Expand Down
3 changes: 2 additions & 1 deletion platforms/ble/battery.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ type BatteryDriver struct {
}

// NewBatteryDriver creates a BatteryDriver
func NewBatteryDriver(a *ClientAdaptor, name string) *BatteryDriver {
func NewBatteryDriver(a *ClientAdaptor) *BatteryDriver {
n := &BatteryDriver{
name: "Battery",
connection: a,
Eventer: gobot.NewEventer(),
}
Expand Down
1 change: 1 addition & 0 deletions platforms/ble/ble_client_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ClientAdaptor struct {
// NewClientAdaptor returns a new ClientAdaptor given a uuid
func NewClientAdaptor(uuid string) *ClientAdaptor {
return &ClientAdaptor{
name: "BLE CLient",
uuid: uuid,
connected: false,
ready: make(chan struct{}),
Expand Down
1 change: 1 addition & 0 deletions platforms/ble/ble_minidrone.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func validatePitch(val int) int {
// NewMinidroneDriver creates a MinidroneDriver
func NewMinidroneDriver(a *ClientAdaptor) *MinidroneDriver {
n := &MinidroneDriver{
name: "Minidrone",
connection: a,
Pcmd: Pcmd{
Flag: 0,
Expand Down
1 change: 1 addition & 0 deletions platforms/ble/device_information.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type DeviceInformationDriver struct {
// NewDeviceInformationDriver creates a DeviceInformationDriver
func NewDeviceInformationDriver(a *ClientAdaptor) *DeviceInformationDriver {
n := &DeviceInformationDriver{
name: "Device Information",
connection: a,
Eventer: gobot.NewEventer(),
}
Expand Down
1 change: 1 addition & 0 deletions platforms/ble/ollie.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type packet struct {
// NewSpheroOllieDriver creates a SpheroOllieDriver
func NewSpheroOllieDriver(a *ClientAdaptor) *SpheroOllieDriver {
n := &SpheroOllieDriver{
name: "Ollie",
connection: a,
Eventer: gobot.NewEventer(),
packetChannel: make(chan *packet, 1024),
Expand Down
1 change: 1 addition & 0 deletions platforms/chip/chip_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var pins = map[string]int{
// NewAdaptor creates a C.H.I.P. Adaptor
func NewAdaptor() *Adaptor {
c := &Adaptor{
name: "C.H.I.P.",
digitalPins: make(map[int]sysfs.DigitalPin),
}
return c
Expand Down
1 change: 1 addition & 0 deletions platforms/digispark/digispark_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Adaptor struct {
// NewAdaptor returns a new Digispark Adaptor
func NewAdaptor() *Adaptor {
return &Adaptor{
name: "Digispark",
connect: func(d *Adaptor) (err error) {
d.littleWire = littleWireConnect()
if d.littleWire.(*littleWire).lwHandle == nil {
Expand Down
1 change: 1 addition & 0 deletions platforms/firmata/firmata_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type Adaptor struct {
// string port as a label to be displayed in the log and api.
func NewAdaptor(args ...interface{}) *Adaptor {
f := &Adaptor{
name: "Firmata",
port: "",
conn: nil,
board: client.New(),
Expand Down
1 change: 1 addition & 0 deletions platforms/intel-iot/edison/edison_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ func changePinMode(pin, mode string) (err error) {
// NewAdaptor returns a new Edison Adaptor
func NewAdaptor() *Adaptor {
return &Adaptor{
name: "Edison",
connect: func(e *Adaptor) (err error) {
e.tristate = sysfs.NewDigitalPin(214)
if err = e.tristate.Export(); err != nil {
Expand Down
1 change: 1 addition & 0 deletions platforms/intel-iot/joule/joule_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ var sysfsPinMap = map[string]sysfsPin{
// NewAdaptor returns a new Joule Adaptor
func NewAdaptor() *Adaptor {
return &Adaptor{
name: "Joule",
connect: func(e *Adaptor) (err error) {
return
},
Expand Down
1 change: 1 addition & 0 deletions platforms/joystick/joystick_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Adaptor struct {
// NewAdaptor returns a new Joystick Adaptor.
func NewAdaptor() *Adaptor {
return &Adaptor{
name: "Joystick",
connect: func(j *Adaptor) (err error) {
sdl.Init(sdl.INIT_JOYSTICK)
if sdl.NumJoysticks() > 0 {
Expand Down
1 change: 1 addition & 0 deletions platforms/joystick/joystick_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type joystickConfig struct {
// time.Duration: Interval at which the Driver is polled for new information
func NewDriver(a *Adaptor, config string, v ...time.Duration) *Driver {
d := &Driver{
name: "Joystick",
connection: a,
Eventer: gobot.NewEventer(),
configPath: config,
Expand Down
1 change: 1 addition & 0 deletions platforms/keyboard/keyboard_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Driver struct {

func NewDriver() *Driver {
k := &Driver{
name: "Keyboard",
connect: func(k *Driver) (err error) {
if err := configure(); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions platforms/leap/leap_motion_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Adaptor struct {
// NewAdaptor creates a new leap motion adaptor using specified port
func NewAdaptor(port string) *Adaptor {
return &Adaptor{
name: "Leap Motion",
port: port,
connect: func(port string) (io.ReadWriteCloser, error) {
return websocket.Dial("ws://"+port+"/v3.json", "", "http://"+port)
Expand Down
1 change: 1 addition & 0 deletions platforms/leap/leap_motion_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var receive = func(ws io.ReadWriteCloser, msg *[]byte) {
// "gesture" - Gets triggered per-message when leap motion detects a hand
func NewDriver(a *Adaptor) *Driver {
l := &Driver{
name: "Leap Motion",
connection: a,
Eventer: gobot.NewEventer(),
}
Expand Down
1 change: 1 addition & 0 deletions platforms/mavlink/mavlink_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Adaptor struct {
// NewAdaptor creates a new mavlink adaptor with specified port
func NewAdaptor(port string) *Adaptor {
return &Adaptor{
name: "Mavlink",
port: port,
connect: func(port string) (io.ReadWriteCloser, error) {
return serial.OpenPort(&serial.Config{Name: port, Baud: 57600})
Expand Down
1 change: 1 addition & 0 deletions platforms/mavlink/mavlink_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type MavlinkInterface interface {
// "message" - triggered when a new valid message is processed
func NewDriver(a *Adaptor, v ...time.Duration) *Driver {
m := &Driver{
name: "Mavlink",
connection: a,
Eventer: gobot.NewEventer(),
interval: 10 * time.Millisecond,
Expand Down
1 change: 1 addition & 0 deletions platforms/megapi/megapi_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Adaptor struct {
func NewAdaptor(device string) *Adaptor {
c := &serial.Config{Name: device, Baud: 115200}
return &Adaptor{
name: "MegaPi",
connection: nil,
serialConfig: c,
writeBytesChannel: make(chan []byte),
Expand Down
1 change: 1 addition & 0 deletions platforms/megapi/motor_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type MotorDriver struct {
// NewMotorDriver creates a new MotorDriver at the given port
func NewMotorDriver(megaPi *Adaptor, port byte) *MotorDriver {
return &MotorDriver{
name: "MegaPi Motor",
megaPi: megaPi,
port: port,
halted: true,
Expand Down
2 changes: 2 additions & 0 deletions platforms/mqtt/mqtt_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ type Adaptor struct {
// NewAdaptor creates a new mqtt adaptor with specified host and client id
func NewAdaptor(host string, clientID string) *Adaptor {
return &Adaptor{
name: "MQTT",
Host: host,
clientID: clientID,
}
}

func NewAdaptorWithAuth(host, clientID, username, password string) *Adaptor {
return &Adaptor{
name: "MQTT",
Host: host,
clientID: clientID,
username: username,
Expand Down
1 change: 1 addition & 0 deletions platforms/nats/nats_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Adaptor struct {
// NewAdaptor populates a new NATS Adaptor.
func NewAdaptor(host string, clientID int) *Adaptor {
return &Adaptor{
name: "NATS",
Host: host,
clientID: clientID,
}
Expand Down
1 change: 1 addition & 0 deletions platforms/neurosky/neurosky_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Adaptor struct {
// NewAdaptor creates a neurosky adaptor with specified port
func NewAdaptor(port string) *Adaptor {
return &Adaptor{
name: "Neurosky",
port: port,
connect: func(n *Adaptor) (io.ReadWriteCloser, error) {
return serial.OpenPort(&serial.Config{Name: n.Port(), Baud: 57600})
Expand Down
1 change: 1 addition & 0 deletions platforms/neurosky/neurosky_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type EEG struct {
// eeg - showing eeg data
func NewDriver(a *Adaptor) *Driver {
n := &Driver{
name: "Neurosky",
connection: a,
Eventer: gobot.NewEventer(),
}
Expand Down

0 comments on commit 07f6749

Please sign in to comment.