diff --git a/source/interactivity.h b/source/interactivity.h index 65a5404..e14c99f 100644 --- a/source/interactivity.h +++ b/source/interactivity.h @@ -9,6 +9,8 @@ //********************************************************* #pragma once +#define MIXER_API __declspec(dllexport) + /** @mainpage Mixer Interactive C++ SDK Documentation This is the API documentation for the Mixer C++ SDK. For a detailed walkthrough of specific features and usage visit https://github.com/mixer/interactive-cpp/wiki. @@ -41,7 +43,7 @@ extern "C" { /// /// This is a blocking function that waits on network IO. /// - int interactive_auth_get_short_code(const char* clientId, const char* clientSecret, char* shortCode, size_t* shortCodeLength, char* shortCodeHandle, size_t* shortCodeHandleLength); + MIXER_API int interactive_auth_get_short_code(const char* clientId, const char* clientSecret, char* shortCode, size_t* shortCodeLength, char* shortCodeHandle, size_t* shortCodeHandleLength); /// /// Wait for a shortCode to be authorized or rejected after presenting the OAuth short code web page. The resulting refreshToken @@ -50,12 +52,12 @@ extern "C" { /// /// This is a blocking function that waits on network IO. /// - int interactive_auth_wait_short_code(const char* clientId, const char* clientSecret, const char* shortCodeHandle, char* refreshToken, size_t* refreshTokenLength); + MIXER_API int interactive_auth_wait_short_code(const char* clientId, const char* clientSecret, const char* shortCodeHandle, char* refreshToken, size_t* refreshTokenLength); /// /// Determine if a refreshToken returned by interactive_auth_wait_short_code is stale. A token is stale if it has exceeded its half-life. /// - int interactive_auth_is_token_stale(const char* token, bool* isStale); + MIXER_API int interactive_auth_is_token_stale(const char* token, bool* isStale); /// /// Refresh a stale refreshToken. @@ -63,12 +65,12 @@ extern "C" { /// /// This is a blocking function that waits on network IO. /// - int interactive_auth_refresh_token(const char* clientId, const char* clientSecret, const char* staleToken, char* refreshToken, size_t* refreshTokenLength); + MIXER_API int interactive_auth_refresh_token(const char* clientId, const char* clientSecret, const char* staleToken, char* refreshToken, size_t* refreshTokenLength); /// /// Parse a refreshToken to get the authorization header that should be passed to interactive_open_session(). /// - int interactive_auth_parse_refresh_token(const char* token, char* authorization, size_t* authorizationLength); + MIXER_API int interactive_auth_parse_refresh_token(const char* token, char* authorization, size_t* authorizationLength); /** @} */ /** @name Session @@ -86,7 +88,7 @@ extern "C" { /// All calls to interactive_open_session must eventually be followed by a call to interactive_close_session to free the handle. /// /// - int interactive_open_session(interactive_session* session); + MIXER_API int interactive_open_session(interactive_session* session); /// /// Asynchronously connect an interactive session. Call interactive_run to bootstrap the connection and call interactive_set_state_changed_handler to respond to connection state changes. @@ -96,7 +98,7 @@ extern "C" { /// The id of the interative project that should be started. /// An optional parameter that is used when starting an interactive project that the user does not have implicit access to. This is usually required unless a project has been published. /// Specifies if the session should set the interactive ready state during connection. If false, this can be manually toggled later with interactive_set_ready - int interactive_connect(interactive_session session, const char* auth, const char* versionId, const char* shareCode, bool setReady); + MIXER_API int interactive_connect(interactive_session session, const char* auth, const char* versionId, const char* shareCode, bool setReady); /// /// Set the ready state for specified session. No participants will be able to see interactive scenes or give input @@ -105,7 +107,7 @@ extern "C" { /// /// This is a blocking function that waits on network IO. /// - int interactive_set_ready(interactive_session session, bool isReady); + MIXER_API int interactive_set_ready(interactive_session session, bool isReady); /// /// This function processes the specified number of events from the interactive service and calls back on registered event handlers. @@ -113,7 +115,7 @@ extern "C" { /// /// This should be called often, at least once per frame, so that interactive input is processed in a timely manner. /// - int interactive_run(interactive_session session, unsigned int maxEventsToProcess); + MIXER_API int interactive_run(interactive_session session, unsigned int maxEventsToProcess); enum interactive_state { @@ -126,17 +128,17 @@ extern "C" { /// /// Get the current interactive_state for the specified session. /// - int interactive_get_state(interactive_session session, interactive_state* state); + MIXER_API int interactive_get_state(interactive_session session, interactive_state* state); /// /// Set a session context that will be passed to every event callback. This context pointer is not read or written by this library, it's purely to enable your code to track state between calls and callbacks if necessary. /// - int interactive_set_session_context(interactive_session session, void* context); + MIXER_API int interactive_set_session_context(interactive_session session, void* context); /// /// Get the previously set session context. Context will be nullptr on return if no context has been set. /// - int interactive_get_session_context(interactive_session session, void** context); + MIXER_API int interactive_get_session_context(interactive_session session, void** context); enum interactive_throttle_type { @@ -152,14 +154,14 @@ extern "C" { /// There is a global throttle on all interactive sessions of 30 megabits and 10 megabits per second by default. /// /// - int interactive_set_bandwidth_throttle(interactive_session session, interactive_throttle_type throttleType, unsigned int maxBytes, unsigned int bytesPerSecond); + MIXER_API int interactive_set_bandwidth_throttle(interactive_session session, interactive_throttle_type throttleType, unsigned int maxBytes, unsigned int bytesPerSecond); /// /// Capture a transaction to charge a participant the input's spark cost. This should be called before /// taking further action on input as the participant may not have enough sparks or the transaction may have expired. /// Register an on_transaction_complete handler to execute actions on the participant's behalf. /// - int interactive_capture_transaction(interactive_session session, const char* transactionId); + MIXER_API int interactive_capture_transaction(interactive_session session, const char* transactionId); /// /// Disconnect from an interactive session and clean up memory. @@ -168,7 +170,7 @@ extern "C" { /// This must not be called from inside an event handler as the lifetime of registered event handlers are assumed to outlive the session. Only call this when there is no thread processing events via interactive_run /// This is a blocking function that waits on outstanding network IO, ensuring all operations are completed before returning. It is not recommended to call this function from the UI thread. /// - void interactive_close_session(interactive_session session); + MIXER_API void interactive_close_session(interactive_session session); /** @} */ /** @name User @@ -200,7 +202,7 @@ extern "C" { /// /// This is a blocking function that waits on network IO. Do not call this from the UI thread. /// - int interactive_get_user(interactive_session session, on_interactive_user onUser); + MIXER_API int interactive_get_user(interactive_session session, on_interactive_user onUser); /** @name Controls * @{ @@ -250,107 +252,107 @@ extern "C" { /// /// Trigger a cooldown on a control for the specified number of milliseconds. /// - int interactive_control_trigger_cooldown(interactive_session session, const char* controlId, const unsigned long long cooldownMs); + MIXER_API int interactive_control_trigger_cooldown(interactive_session session, const char* controlId, const unsigned long long cooldownMs); /// /// Get the number of properties on the control. /// - int interactive_control_get_property_count(interactive_session session, const char* controlId, size_t* count); + MIXER_API int interactive_control_get_property_count(interactive_session session, const char* controlId, size_t* count); /// /// Get the name and type of the property at the given index. /// - int interactive_control_get_property_data(interactive_session session, const char* controlId, size_t index, char* propName, size_t* propNameLength, interactive_property_type* type); + MIXER_API int interactive_control_get_property_data(interactive_session session, const char* controlId, size_t index, char* propName, size_t* propNameLength, interactive_property_type* type); /// /// Get the number of meta properties on the control. /// - int interactive_control_get_meta_property_count(interactive_session session, const char* controlId, size_t* count); + MIXER_API int interactive_control_get_meta_property_count(interactive_session session, const char* controlId, size_t* count); /// /// Get the name and type of the meta property at the given index. /// - int interactive_control_get_meta_property_data(interactive_session session, const char* controlId, size_t index, char* propName, size_t* propNameLength, interactive_property_type* type); + MIXER_API int interactive_control_get_meta_property_data(interactive_session session, const char* controlId, size_t index, char* propName, size_t* propNameLength, interactive_property_type* type); /// /// Get an int property value by name. /// - int interactive_control_get_property_int(interactive_session session, const char* controlId, const char* key, int* property); + MIXER_API int interactive_control_get_property_int(interactive_session session, const char* controlId, const char* key, int* property); /// /// Get a long long property value by name. /// - int interactive_control_get_property_int64(interactive_session session, const char* controlId, const char* key, long long* property); + MIXER_API int interactive_control_get_property_int64(interactive_session session, const char* controlId, const char* key, long long* property); /// /// Get a bool property value by name. /// - int interactive_control_get_property_bool(interactive_session session, const char* controlId, const char* key, bool* property); + MIXER_API int interactive_control_get_property_bool(interactive_session session, const char* controlId, const char* key, bool* property); /// /// Get a float property value by name. /// - int interactive_control_get_property_float(interactive_session session, const char* controlId, const char* key, float* property); + MIXER_API int interactive_control_get_property_float(interactive_session session, const char* controlId, const char* key, float* property); /// /// Get a char* property value by name. /// - int interactive_control_get_property_string(interactive_session session, const char* controlId, const char* key, char* property, size_t* propertyLength); + MIXER_API int interactive_control_get_property_string(interactive_session session, const char* controlId, const char* key, char* property, size_t* propertyLength); /// /// Set a control property to null. /// - int interactive_control_set_property_null(interactive_session session, const char* controlId, const char* key); + MIXER_API int interactive_control_set_property_null(interactive_session session, const char* controlId, const char* key); /// /// Set an int property value by name. /// - int interactive_control_set_property_int(interactive_session session, const char* controlId, const char* key, int property); + MIXER_API int interactive_control_set_property_int(interactive_session session, const char* controlId, const char* key, int property); /// /// Set a long long property value by name. /// - int interactive_control_set_property_int64(interactive_session session, const char* controlId, const char* key, long long property); + MIXER_API int interactive_control_set_property_int64(interactive_session session, const char* controlId, const char* key, long long property); /// /// Set a bool property value by name. /// - int interactive_control_set_property_bool(interactive_session session, const char* controlId, const char* key, bool property); + MIXER_API int interactive_control_set_property_bool(interactive_session session, const char* controlId, const char* key, bool property); /// /// Set a float property value by name. /// - int interactive_control_set_property_float(interactive_session session, const char* controlId, const char* key, float property); + MIXER_API int interactive_control_set_property_float(interactive_session session, const char* controlId, const char* key, float property); /// /// Set a char* property value by name. /// - int interactive_control_set_property_string(interactive_session session, const char* controlId, const char* key, const char* property); + MIXER_API int interactive_control_set_property_string(interactive_session session, const char* controlId, const char* key, const char* property); /// /// Get an int meta property value by name. /// - int interactive_control_get_meta_property_int(interactive_session session, const char* controlId, const char* key, int* property); + MIXER_API int interactive_control_get_meta_property_int(interactive_session session, const char* controlId, const char* key, int* property); /// /// Get a long long meta property value by name. /// - int interactive_control_get_meta_property_int64(interactive_session session, const char* controlId, const char* key, long long* property); + MIXER_API int interactive_control_get_meta_property_int64(interactive_session session, const char* controlId, const char* key, long long* property); /// /// Get a bool meta property value by name. /// - int interactive_control_get_meta_property_bool(interactive_session session, const char* controlId, const char* key, bool* property); + MIXER_API int interactive_control_get_meta_property_bool(interactive_session session, const char* controlId, const char* key, bool* property); /// /// Get a float meta property value by name. /// - int interactive_control_get_meta_property_float(interactive_session session, const char* controlId, const char* key, float* property); + MIXER_API int interactive_control_get_meta_property_float(interactive_session session, const char* controlId, const char* key, float* property); /// /// Get a char* meta property value by name. /// - int interactive_control_get_meta_property_string(interactive_session session, const char* controlId, const char* key, char* property, size_t* propertyLength); + MIXER_API int interactive_control_get_meta_property_string(interactive_session session, const char* controlId, const char* key, char* property, size_t* propertyLength); /** @} */ /** @name Groups @@ -371,18 +373,18 @@ extern "C" { /// /// Get the interactive groups for the specified session. /// - int interactive_get_groups(interactive_session session, on_group_enumerate onGroup); + MIXER_API int interactive_get_groups(interactive_session session, on_group_enumerate onGroup); /// /// Create a new group for the specified session with the specified scene for participants in this group. If no scene is specified it will be set /// to the default scene. /// - int interactive_create_group(interactive_session session, const char* groupId, const char* sceneId); + MIXER_API int interactive_create_group(interactive_session session, const char* groupId, const char* sceneId); /// /// Set a group's scene for the specified session. Use this and interative_set_participant_group to manage which scenes participants see. /// - int interactive_group_set_scene(interactive_session session, const char* groupId, const char* sceneId); + MIXER_API int interactive_group_set_scene(interactive_session session, const char* groupId, const char* sceneId); /** @} */ /** @name Scenes @@ -401,17 +403,17 @@ extern "C" { /// /// Get all scenes for the specified session. /// - int interactive_get_scenes(interactive_session session, on_scene_enumerate onScene); + MIXER_API int interactive_get_scenes(interactive_session session, on_scene_enumerate onScene); /// /// Get each group that this scene belongs to for the specified session. /// - int interactive_scene_get_groups(interactive_session session, const char* sceneId, on_group_enumerate onGroup); + MIXER_API int interactive_scene_get_groups(interactive_session session, const char* sceneId, on_group_enumerate onGroup); /// /// Get a scene's controls for the specified session. /// - int interactive_scene_get_controls(interactive_session session, const char* sceneId, on_control_enumerate onControl); + MIXER_API int interactive_scene_get_controls(interactive_session session, const char* sceneId, on_control_enumerate onControl); /** @} */ /** @name Events and Handlers @@ -513,37 +515,37 @@ extern "C" { /// /// Set the handler function for errors. This function may be called by a background thread so be careful when updating UI. /// - int interactive_set_error_handler(interactive_session session, on_error onError); + MIXER_API int interactive_set_error_handler(interactive_session session, on_error onError); /// /// Set the handler function for state changes. This function is called by your own thread during interactive_run /// - int interactive_set_state_changed_handler(interactive_session session, on_state_changed onStateChanged); + MIXER_API int interactive_set_state_changed_handler(interactive_session session, on_state_changed onStateChanged); /// /// Set the handler function for interactive input. This function is called by your own thread during interactive_run /// - int interactive_set_input_handler(interactive_session session, on_input onInput); + MIXER_API int interactive_set_input_handler(interactive_session session, on_input onInput); /// /// Set the handler function for participants changing. This function is called by your own thread during interactive_run /// - int interactive_set_participants_changed_handler(interactive_session session, on_participants_changed onParticipantsChanged); + MIXER_API int interactive_set_participants_changed_handler(interactive_session session, on_participants_changed onParticipantsChanged); /// /// Set the handler function for spark transaction completion. This function is called by your own thread during interactive_run /// - int interactive_set_transaction_complete_handler(interactive_session session, on_transaction_complete onTransactionComplete); + MIXER_API int interactive_set_transaction_complete_handler(interactive_session session, on_transaction_complete onTransactionComplete); /// /// Set the handler function for changes to controls. This function is called by your own thread during interactive_run /// - int interactive_set_control_changed_handler(interactive_session session, on_control_changed onControlChanged); + MIXER_API int interactive_set_control_changed_handler(interactive_session session, on_control_changed onControlChanged); /// /// Set the handler function for unhandled methods. This may be useful for more advanced scenarios or future protocol changes that may not have existed in this version of the library. This function is called by your own thread during interactive_run /// - int interactive_set_unhandled_method_handler(interactive_session session, on_unhandled_method onUnhandledMethod); + MIXER_API int interactive_set_unhandled_method_handler(interactive_session session, on_unhandled_method onUnhandledMethod); /** @} */ /** @name Participants @@ -555,47 +557,47 @@ extern "C" { /// /// Get all participants (viewers) for the specified session. /// - int interactive_get_participants(interactive_session session, on_participant_enumerate onParticipant); + MIXER_API int interactive_get_participants(interactive_session session, on_participant_enumerate onParticipant); /// /// Change the participant's group Use this along with interactive_group_set_scene to configure which scene a participant sees. All participants join the 'default' (case sensitive) group when joining a session. /// - int interactive_participant_set_group(interactive_session session, const char* participantId, const char* groupId); + MIXER_API int interactive_participant_set_group(interactive_session session, const char* participantId, const char* groupId); /// /// Get the participant's user id. /// - int interactive_participant_get_user_id(interactive_session session, const char* participantId, unsigned int* userId); + MIXER_API int interactive_participant_get_user_id(interactive_session session, const char* participantId, unsigned int* userId); /// /// Get the participant's user name. /// - int interactive_participant_get_user_name(interactive_session session, const char* participantId, char* userName, size_t* userNameLength); + MIXER_API int interactive_participant_get_user_name(interactive_session session, const char* participantId, char* userName, size_t* userNameLength); /// /// Get the participant's level. /// - int interactive_participant_get_level(interactive_session session, const char* participantId, unsigned int* level); + MIXER_API int interactive_participant_get_level(interactive_session session, const char* participantId, unsigned int* level); /// /// Get the participant's last input time as a unix millisecond timestamp. /// - int interactive_participant_get_last_input_at(interactive_session session, const char* participantId, unsigned long long* lastInputAt); + MIXER_API int interactive_participant_get_last_input_at(interactive_session session, const char* participantId, unsigned long long* lastInputAt); /// /// Get the participant's unix millisecond timestamp when they connected to the session. /// - int interactive_participant_get_connected_at(interactive_session session, const char* participantId, unsigned long long* connectedAt); + MIXER_API int interactive_participant_get_connected_at(interactive_session session, const char* participantId, unsigned long long* connectedAt); /// /// Is the participant's input disabled? /// - int interactive_participant_is_disabled(interactive_session session, const char* participantId, bool* isDisabled); + MIXER_API int interactive_participant_is_disabled(interactive_session session, const char* participantId, bool* isDisabled); /// /// Get the participant's group name. /// - int interactive_participant_get_group(interactive_session session, const char* participantId, char* group, size_t* groupLength); + MIXER_API int interactive_participant_get_group(interactive_session session, const char* participantId, char* group, size_t* groupLength); /** @} */ /** @name Manual Protocol Integration @@ -608,7 +610,7 @@ extern "C" { /// Send a method to the interactive session. This may be used to interface with the interactive protocol directly and implement functionality /// that this SDK does not provide. /// - int interactive_queue_method(interactive_session session, const char* method, const char* paramsJson, const on_method_reply onReply); + MIXER_API int interactive_queue_method(interactive_session session, const char* method, const char* paramsJson, const on_method_reply onReply); /** @} */ @@ -632,12 +634,12 @@ extern "C" { /// /// Configure the debug verbosity for all interactive sessions in the current process. /// - void interactive_config_debug_level(const interactive_debug_level dbgLevel); + MIXER_API void interactive_config_debug_level(const interactive_debug_level dbgLevel); /// /// Configure the debug verbosity and set the debug callback function for all interactive sessions in the current process. /// - void interactive_config_debug(const interactive_debug_level dbgLevel, on_debug_msg dbgCallback); + MIXER_API void interactive_config_debug(const interactive_debug_level dbgLevel, on_debug_msg dbgCallback); /** @} */ /** @name Error Codes