ContextC.h (2751B)
1 /** @file 2 @brief Header 3 4 Must be c-safe! 5 6 @todo Apply annotation macros 7 8 @date 2014 9 10 @author 11 Sensics, Inc. 12 <http://sensics.com/osvr> 13 */ 14 15 /* 16 // Copyright 2014 Sensics, Inc. 17 // 18 // Licensed under the Apache License, Version 2.0 (the "License"); 19 // you may not use this file except in compliance with the License. 20 // You may obtain a copy of the License at 21 // 22 // http://www.apache.org/licenses/LICENSE-2.0 23 // 24 // Unless required by applicable law or agreed to in writing, software 25 // distributed under the License is distributed on an "AS IS" BASIS, 26 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 // See the License for the specific language governing permissions and 28 // limitations under the License. 29 */ 30 31 #ifndef INCLUDED_ContextC_h_GUID_3790F330_2425_4486_4C9F_20C300D7DED3 32 #define INCLUDED_ContextC_h_GUID_3790F330_2425_4486_4C9F_20C300D7DED3 33 34 /* Internal Includes */ 35 #include <osvr/ClientKit/Export.h> 36 #include <osvr/Util/APIBaseC.h> 37 #include <osvr/Util/ReturnCodesC.h> 38 #include <osvr/Util/AnnotationMacrosC.h> 39 #include <osvr/Util/StdInt.h> 40 #include <osvr/Util/ClientOpaqueTypesC.h> 41 42 /* Library/third-party includes */ 43 /* none */ 44 45 /* Standard includes */ 46 /* none */ 47 48 OSVR_EXTERN_C_BEGIN 49 50 /** @addtogroup ClientKit 51 @{ 52 */ 53 54 /** @brief Initialize the library. 55 56 @param applicationIdentifier A null terminated string identifying your 57 application. Reverse DNS format strongly suggested. 58 @param flags initialization options (reserved) - pass 0 for now. 59 60 @returns Client context - will be needed for subsequent calls 61 */ 62 OSVR_CLIENTKIT_EXPORT OSVR_ClientContext osvrClientInit( 63 const char applicationIdentifier[], uint32_t flags OSVR_CPP_ONLY(= 0)); 64 65 /** @brief Updates the state of the context - call regularly in your mainloop. 66 67 @param ctx Client context 68 */ 69 OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode osvrClientUpdate(OSVR_ClientContext ctx); 70 71 /** @brief Checks to see if the client context is fully started up and connected 72 properly to a server. 73 74 If this reports that the client context is not OK, there may not be a server 75 running, or you may just have to call osvrClientUpdate() a few times to 76 permit startup to finish. The return value of this call will not change from 77 failure to success without calling osvrClientUpdate(). 78 79 @param ctx Client context 80 81 @return OSVR_RETURN_FAILURE if not yet fully connected/initialized, or if 82 some other error (null context) occurs. 83 */ 84 OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode 85 osvrClientCheckStatus(OSVR_ClientContext ctx); 86 87 /** @brief Shutdown the library. 88 @param ctx Client context 89 */ 90 OSVR_CLIENTKIT_EXPORT OSVR_ReturnCode 91 osvrClientShutdown(OSVR_ClientContext ctx); 92 93 /** @} */ 94 OSVR_EXTERN_C_END 95 96 #endif