GCGalileo Class Reference

Inherits from NSObject
Declared in GCGalileo.h

Overview

The Galileo class provides a singleton instance representing the currently attached Galileo device.

You can register as an observer of the GCDidConnectNotification and GCDidDisconnectNotification notifications to be notified when Galileo is connected and disconnected. Alternatively, you can associate a custom delegate with the Galileo object to be notified when Galileo is connected and disconnected. Your delegate must adopt the GCGalileoDelegate protocol.

Connection attempts will not be made until the waitForConnection method is called.

Getting the Galileo instance

+ sharedGalileo

Returns the singleton Galileo instance.

+ (GCGalileo *)sharedGalileo

Declared In

GCGalileo.h

Setting and Getting the Delegate

  delegate

The delegate of the Galileo object.

@property (nonatomic, assign) id<GCGalileoDelegate> delegate

Discussion

The delegate must adopt the GCGalileoDelegate protocol. The delegate is not retained.

Declared In

GCGalileo.h

Managing the connection to Galileo

– waitForConnection

Wait until a Galileo accessory is connected.

- (void)waitForConnection

Discussion

Once connected the GCDidConnectNotification will be posted and the delegate will be notified via the method galileoDidConnect. If a Galileo accessory is already attached to the device then notification will occur instantly. Otherwise, notification will occur when the accessory is plugged in to the device.

Declared In

GCGalileo.h

– isConnected

Check if a Galileo accessory is connected and ready to recieve commands.

- (BOOL)isConnected

Declared In

GCGalileo.h

– disconnect

Disconnect a connected Galileo accessory.

- (void)disconnect

Declared In

GCGalileo.h

  modelType

The model type of the connected Galileo.

@property (nonatomic, readonly) NSString *modelType

Discussion

This is a human-readable string generated from Galileo’s hardwareVersion property.

Declared In

GCGalileo.h

Acccessing Galileo properties

  shouldAutoConnectToKnownGalileo

True if Galileo will attempt to auto-connect (without user action) to previously known Galileo devices.

@property (nonatomic) BOOL shouldAutoConnectToKnownGalileo

Discussion

By default this value is true. If your app specifically requires disconnecting or reconnecting to/from Galileo, or if your app is used in an environment with multiple Galileos, you may wish to set this value to false. Note that this only effects Bluetooth devices.

Declared In

GCGalileo.h

  canRunInBackground

True if Galileo can remain connected whilst the app is in the background.

@property (nonatomic) BOOL canRunInBackground

Discussion

By default this value is false, Galileo will disconnect whenever the app enters background mode (for example, when the user depresses the home button). Developers are strongly encouraged not to change this value since it is a source of confusion for users, who have come to expect Galileo to disconnect when they minimise the app. However, for very specific app use cases this behavaour may be required.

Declared In

GCGalileo.h

  modelName

The name of the connected Galileo.

@property (nonatomic, retain) NSString *modelName

Discussion

For Bluetooth-type Galileo models, this is the name presented to the user when asked to be paired.

Declared In

GCGalileo.h

  batteryLevelPercent

Remaining battery charge as a percentage of total.

@property (nonatomic, readonly) unsigned int batteryLevelPercent

Discussion

On early (Kickstarter) Galileo models this value will only provide a rough indication of remaining battery level. Values of 25% or less should be considered low and values of 70% or above considered high. This corresponds to the three LED indicator states on the base of Galileo (red, amber, green).

Declared In

GCGalileo.h

  connectedToPowerSource

True if Galileo is connected to a power source.

@property (nonatomic, readonly, getter=isConnectedToPowerSource) BOOL connectedToPowerSource

Declared In

GCGalileo.h

  hardwareVersion

Hardware version for the currently connected Galileo.

@property (nonatomic, readonly) GCHardwareVersion hardwareVersion

Discussion

If no Galileo is connected this will return the hardware version of the last Galileo that was connected.

Declared In

GCGalileo.h

  firmwareVersion

Firmware version for the currently connected Galileo.

@property (nonatomic, readonly) unsigned int firmwareVersion

Discussion

If no Galileo is connected this will return the firmware version of the last Galileo that was connected.

Declared In

GCGalileo.h

Moving Galileo

– selectMode:forAxis:

Attempt to switch Galileo into a specified mode.

- (BOOL)selectMode:(GCMode)newMode forAxis:(GCControlAxis)axis

Parameters

newMode

Desired mode you wish to switch to.

axis

Axis you wish to change modes on.

Return Value

Returns True if mode selection was succesful.

Discussion

Mode selection is typically performed automatically. Explicit calls are only required when switching back and forth between different motion control modes. Mode selection can fail if Galileo is unplugged or if a firmware update is in progress.

Declared In

GCGalileo.h

– modeForAxis:

Get the current mode for a given axis.

- (GCMode)modeForAxis:(GCControlAxis)axis

Parameters

axis

Axis you wish to obtain the modes for.

Return Value

Returns the current mode.

Declared In

GCGalileo.h

– velocityControlForAxis:

Control Galileo’s velocity for a specified axis.

- (GCVelocityControl *)velocityControlForAxis:(GCControlAxis)axis

Parameters

axis

Axis you wish to control velocity for.

Return Value

Returns a GCVelocityControl object for controlling Galileo’s velocity.

Declared In

GCGalileo.h

– positionControlForAxis:

Control Galileo’s position for a specified axis.

- (GCPositionControl *)positionControlForAxis:(GCControlAxis)axis

Parameters

axis

Axis you wish to control position for.

Return Value

Returns a GCPositionControl object for controlling Galileo’s position.

Declared In

GCGalileo.h

Managing Galileo firmware

  isMotrrAppInstalled

Check if the device has the Motrr app installed.

@property (nonatomic, readonly) BOOL isMotrrAppInstalled

Discussion

This property is a good proxy for determining if the user is a Galileo user or not. All Galileo users are instructed to download and install the Motrr app upon purchasing their Galileo.

Declared In

GCGalileo.h

  firmwareManager

Manage Galileo’s firmware.

@property (nonatomic, readonly) GCFirmwareManager *firmwareManager

Declared In

GCGalileo.h

Framework logging

  logLevel

Set the required level of logging detail.

@property (nonatomic) GCLogLevel logLevel

Discussion

Default is GCLogLevelNone.

Declared In

GCGalileo.h

  overrideLoggingFunction

Override the default logging function with your own.

@property (nonatomic, copy) void ( ^ ) ( GCLogLevel logLevel , const char *functionName , unsigned int lineNumber , NSString *format , va_list args ) overrideLoggingFunction

Discussion

Use this to redirect framework log output. An example use would be remote logging to TestFlight using TFLog (requires TestFlight SDK). Set this property to nil to restore default behaviour.

Declared In

GCGalileo.h