OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
DisplayParameter.c
Go to the documentation of this file.
1 
11 /*
12 // Copyright 2014 Sensics, Inc.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "License");
15 // you may not use this file except in compliance with the License.
16 // You may obtain a copy of the License at
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 // See the License for the specific language governing permissions and
24 // limitations under the License.
25 */
26 
27 /* Internal Includes */
30 
31 /* Library/third-party includes */
32 /* none */
33 
34 /* Standard includes */
35 #include <stdio.h>
36 #include <stdlib.h>
37 
38 int main() {
39  OSVR_ClientContext ctx =
40  osvrClientInit("com.osvr.exampleclients.DisplayParameter", 0);
41 
42  const char *path = "/display";
43 
44  size_t length;
45  osvrClientGetStringParameterLength(ctx, path, &length);
46 
47  char *displayDescription = malloc(length);
48  osvrClientGetStringParameter(ctx, path, displayDescription, length);
49 
50  printf("Got value of %s:\n%s\n", path, displayDescription);
51 
52  free(displayDescription);
53  osvrClientShutdown(ctx);
54  printf("Library shut down, exiting.\n");
55  return 0;
56 }
OSVR_ClientContext osvrClientInit(const char applicationIdentifier[], uint32_t flags=0)
Initialize the library.
OSVR_ReturnCode osvrClientGetStringParameterLength(OSVR_ClientContext ctx, const char path[], size_t *len)
Get the length of a string parameter associated with the given path.
size< coerce_list< Ts...>> length
Synonym for typepack::size.
Definition: Size.h:59
OSVR_ReturnCode osvrClientShutdown(OSVR_ClientContext ctx)
Shutdown the library.
struct OSVR_ClientContextObject * OSVR_ClientContext
Opaque handle that should be retained by your application. You need only and exactly one...
OSVR_ReturnCode osvrClientGetStringParameter(OSVR_ClientContext ctx, const char path[], char *buf, size_t len)
Get a string parameter associated with the given path.
Header.