Overte C++ Documentation
ConnexionClientAPI.h
1 //==============================================================================
2 
3 #ifndef _H_connexionclientapi
4 #define _H_connexionclientapi
5 
6 #include <stdbool.h>
7 #include "ConnexionClient.h"
8 
9 //==============================================================================
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 //==============================================================================
14 // Callback procedure types
15 
16 typedef void (*ConnexionAddedHandlerProc) (unsigned int productID);
17 typedef void (*ConnexionRemovedHandlerProc) (unsigned int productID);
18 typedef void (*ConnexionMessageHandlerProc) (unsigned int productID, unsigned int messageType, void *messageArgument);
19 
20 // NOTE for ConnexionMessageHandlerProc:
21 // when messageType == kConnexionMsgDeviceState, messageArgument points to ConnexionDeviceState with size kConnexionDeviceStateSize
22 // when messageType == kConnexionMsgPrefsChanged, messageArgument points to the target application signature with size sizeof(uint32_t)
23 
24 //==============================================================================
25 // Public APIs to be called once when the application starts up or shuts down
26 
27 int16_t SetConnexionHandlers (ConnexionMessageHandlerProc messageHandler, ConnexionAddedHandlerProc addedHandler, ConnexionRemovedHandlerProc removedHandler, bool useSeparateThread);
28 void CleanupConnexionHandlers (void);
29 
30 // Obsolete API replaced by SetConnexionHandlers, will be removed in the future
31 
32 int16_t InstallConnexionHandlers (ConnexionMessageHandlerProc messageHandler, ConnexionAddedHandlerProc addedHandler, ConnexionRemovedHandlerProc removedHandler);
33 
34 //==============================================================================
35 // Public APIs to be called whenever the app wants to start/stop receiving data
36 // the mask parameter (client capabilities mask) specifies which controls must be forwarded to the client
37 // buttonMask (previously part of the client capabilities mask) specifies which buttons must be forwarded to the client
38 
39 uint16_t RegisterConnexionClient (uint32_t signature, uint8_t *name, uint16_t mode, uint32_t mask);
40 void SetConnexionClientMask (uint16_t clientID, uint32_t mask);
41 void SetConnexionClientButtonMask (uint16_t clientID, uint32_t buttonMask);
42 void UnregisterConnexionClient (uint16_t clientID);
43 
44 //==============================================================================
45 // Public API to send control commands to the driver and retrieve a result value
46 // Note: the new ConnexionClientControl variant is strictly required for
47 // kConnexionCtlSetSwitches and kConnexionCtlClearSwitches but also works for
48 // all other Control calls. The old variant remains for backwards compatibility.
49 
50 int16_t ConnexionControl (uint32_t message, int32_t param, int32_t *result);
51 int16_t ConnexionClientControl (uint16_t clientID, uint32_t message, int32_t param, int32_t *result);
52 
53 //==============================================================================
54 // Public API to fetch the current device preferences for either the first connected device or a specific device type (kDevID_Xxx)
55 
56 int16_t ConnexionGetCurrentDevicePrefs (uint32_t deviceID, ConnexionDevicePrefs *prefs);
57 
58 //==============================================================================
59 // Public API to set all button labels in the iOS/Android "virtual device" apps
60 
61 int16_t ConnexionSetButtonLabels (uint8_t *labels, uint16_t size);
62 
63 // Labels data is a series of 32 variable-length null-terminated UTF8-encoded strings.
64 // The sequence of strings follows the SpacePilot Pro button numbering.
65 // Empty strings revert the button label to its default value.
66 // As an example, this data would set the label for button Top to "Top" and
67 // revert all other button labels to their default values:
68 //
69 // 0x00, // empty string for Menu
70 // 0x00, // empty string for Fit
71 // 0x54, 0x6F, 0x70, 0x00, // utf-8 encoded "Top" string for Top
72 // 0x00, // empty string for Left
73 // 0x00, 0x00, 0x00, 0x00, // empty strings for Right, Front, etc...
74 // 0x00, 0x00, 0x00, 0x00,
75 // 0x00, 0x00, 0x00, 0x00,
76 // 0x00, 0x00, 0x00, 0x00,
77 // 0x00, 0x00, 0x00, 0x00,
78 // 0x00, 0x00, 0x00, 0x00,
79 // 0x00, 0x00, 0x00, 0x00
80 //==============================================================================
81 #ifdef __cplusplus
82 }
83 #endif
84 //==============================================================================
85 
86 #endif // _H_connexionclientapi
87 
88 //==============================================================================