gForceSDK
HubListener.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017, OYMotion Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28  * DAMAGE.
29  *
30  */
38 #pragma once
39 
40 #include "gfTypes.h"
41 #include "Quaternion.h"
42 
43 #include <vector>
44 
45 namespace gf
46 {
47 
56  {
57  public:
62  virtual void onScanFinished() {}
63 
68  virtual void onStateChanged(HubState state) {}
69 
74  virtual void onDeviceFound(SPDEVICE device) {}
75 
82  virtual void onDeviceDiscard(SPDEVICE device) {}
83 
89  virtual void onDeviceConnected(SPDEVICE device) {}
90 
97  virtual void onDeviceDisconnected(SPDEVICE device, GF_UINT8 reason) {}
98 
107  virtual void onOrientationData(SPDEVICE device, const Quaternion& orientation) {}
108 
112  virtual void onGestureData(SPDEVICE device, Gesture gest) {}
113 
126  virtual void onDeviceStatusChanged(SPDEVICE device, DeviceStatus status) {}
127 
132  virtual void onExtendedDeviceData(SPDEVICE device, DeviceDataType dataType, gfsPtr<const std::vector<GF_UINT8>> data) {}
133 
134  virtual ~HubListener() {}
135  };
136 }
virtual void onDeviceDisconnected(SPDEVICE device, GF_UINT8 reason)
This callback is called when a device has been disconnected from connection state or failed to connec...
Definition: HubListener.h:97
DeviceDataType
Define the data types the device do support.
Definition: gfTypes.h:214
gfsPtr< Device > SPDEVICE
the strong pointer to Device
Definition: gfTypes.h:119
virtual void onScanFinished()
This callback is called when the Hub finishes scanning devices.
Definition: HubListener.h:62
The callback interface for processing messages from the Hub.
Definition: HubListener.h:55
virtual void onGestureData(SPDEVICE device, Gesture gest)
This callback is called when the gesture data is recevied.
Definition: HubListener.h:112
Data type of quaternion.
Definition: Quaternion.h:101
virtual void onDeviceDiscard(SPDEVICE device)
This callback is called when a previously found but not connected device has been dropped by the Hub...
Definition: HubListener.h:82
virtual void onOrientationData(SPDEVICE device, const Quaternion &orientation)
This callback is called when the orientation of the device has changed.
Definition: HubListener.h:107
Gesture
Gesture types predefined in the gForce device.
Definition: gfTypes.h:163
HubState
Possible Hub states.
Definition: gfTypes.h:195
The namespace in which all of the gForceSDK project definitions are contained.
Definition: Device.h:42
DeviceStatus
Device status notification of a gForce device.
Definition: gfTypes.h:185
Quaternion data type.
std::shared_ptr< T > gfsPtr
The strong pointer.
Definition: gfTypes.h:113
virtual void onDeviceStatusChanged(SPDEVICE device, DeviceStatus status)
This callback is called when the device status has been changed.
Definition: HubListener.h:126
virtual void onDeviceConnected(SPDEVICE device)
This callback is called when a device has been connected to the hub successfully. ...
Definition: HubListener.h:89
virtual void onExtendedDeviceData(SPDEVICE device, DeviceDataType dataType, gfsPtr< const std::vector< GF_UINT8 >> data)
This callback is called when the extended data is recevied.
Definition: HubListener.h:132
virtual void onStateChanged(HubState state)
This callback is called when the state of the hub changed.
Definition: HubListener.h:68
The basic type definitions using in gForceSDK.
virtual void onDeviceFound(SPDEVICE device)
This callback is called when the hub finds a device during scanning.
Definition: HubListener.h:74
unsigned char GF_UINT8
type definition
Definition: gfTypes.h:65