gForceSDK
gf::HubListener Class Reference

The callback interface for processing messages from the Hub. More...

#include <HubListener.h>

Public Member Functions

virtual void onScanFinished ()
 This callback is called when the Hub finishes scanning devices. More...
 
virtual void onStateChanged (HubState state)
 This callback is called when the state of the hub changed. More...
 
virtual void onDeviceFound (SPDEVICE device)
 This callback is called when the hub finds a device during scanning. More...
 
virtual void onDeviceDiscard (SPDEVICE device)
 This callback is called when a previously found but not connected device has been dropped by the Hub. More...
 
virtual void onDeviceConnected (SPDEVICE device)
 This callback is called when a device has been connected to the hub successfully. More...
 
virtual void onDeviceDisconnected (SPDEVICE device, GF_UINT8 reason)
 This callback is called when a device has been disconnected from connection state or failed to connect to. More...
 
virtual void onOrientationData (SPDEVICE device, const Quaternion &orientation)
 This callback is called when the orientation of the device has changed. More...
 
virtual void onGestureData (SPDEVICE device, Gesture gest)
 This callback is called when the gesture data is recevied. More...
 
virtual void onDeviceStatusChanged (SPDEVICE device, DeviceStatus status)
 This callback is called when the device status has been changed. More...
 
virtual void onExtendedDeviceData (SPDEVICE device, DeviceDataType dataType, gfsPtr< const std::vector< GF_UINT8 >> data)
 This callback is called when the extended data is recevied. More...
 

Detailed Description

The callback interface for processing messages from the Hub.

The application needs to implement this class and pass its instance to Hub::registerListener()

Member Function Documentation

◆ onDeviceConnected()

virtual void gf::HubListener::onDeviceConnected ( SPDEVICE  device)
inlinevirtual

This callback is called when a device has been connected to the hub successfully.

Parameters
deviceThe pointer to the Device object that the hub has connected to.

◆ onDeviceDiscard()

virtual void gf::HubListener::onDeviceDiscard ( SPDEVICE  device)
inlinevirtual

This callback is called when a previously found but not connected device has been dropped by the Hub.

Parameters
deviceThe pointer to the Device object that was previously found and passed to the application.

◆ onDeviceDisconnected()

virtual void gf::HubListener::onDeviceDisconnected ( SPDEVICE  device,
GF_UINT8  reason 
)
inlinevirtual

This callback is called when a device has been disconnected from connection state or failed to connect to.

Parameters
deviceThe pointer to the Device object that was disconnected.
reasonThe reason of why device disconnected.

◆ onDeviceFound()

virtual void gf::HubListener::onDeviceFound ( SPDEVICE  device)
inlinevirtual

This callback is called when the hub finds a device during scanning.

Parameters
deviceThe pointer to a Device object that was found.

◆ onDeviceStatusChanged()

virtual void gf::HubListener::onDeviceStatusChanged ( SPDEVICE  device,
DeviceStatus  status 
)
inlinevirtual

This callback is called when the device status has been changed.

Parameters
devicePointer to the Device sending data
statusWhat status of the device has been changed
Remarks
DeviceStatus::ReCenter: Notifiy the application of that the user has re-centered the device, by pressing the button on the gForce device, to use his/her current orientation as the origin of his/her coordinate system (i.e. [w=1, x=0, y=0, z=0] in quaternion). Please also see Google Daydram - Re-center your view & cursor DeviceStatus::Motionless: Notify that the device doesn't detect user motion in long time, so it will turn to standby mode.

◆ onExtendedDeviceData()

virtual void gf::HubListener::onExtendedDeviceData ( SPDEVICE  device,
DeviceDataType  dataType,
gfsPtr< const std::vector< GF_UINT8 >>  data 
)
inlinevirtual

This callback is called when the extended data is recevied.

Parameters
deviceThe Pointer to the Device.
dataTypeThe data type carried
dataThe data buffer managed by reference

◆ onGestureData()

virtual void gf::HubListener::onGestureData ( SPDEVICE  device,
Gesture  gest 
)
inlinevirtual

This callback is called when the gesture data is recevied.

Parameters
deviceThe Pointer to the Device.
gestThe Gesture object.

◆ onOrientationData()

virtual void gf::HubListener::onOrientationData ( SPDEVICE  device,
const Quaternion orientation 
)
inlinevirtual

This callback is called when the orientation of the device has changed.

Parameters
deviceThe pointer to the Device.
orientationThe Quaternion object that indicates the updated orientation of the device.

◆ onScanFinished()

virtual void gf::HubListener::onScanFinished ( )
inlinevirtual

This callback is called when the Hub finishes scanning devices.

Remarks
This callback may be called after a series of onDeviceFound() are called.

◆ onStateChanged()

virtual void gf::HubListener::onStateChanged ( HubState  state)
inlinevirtual

This callback is called when the state of the hub changed.

Parameters
stateAn enumerated value of HubState which indicates the state of the hub.

The documentation for this class was generated from the following file: