Changeset 94 for trunk/libfreebobctl
- Timestamp:
- 05/15/05 07:13:05 (18 years ago)
- Files:
-
- trunk/libfreebobctl/examples/test-freebobctl-osc.c (modified) (2 diffs)
- trunk/libfreebobctl/src/ipchandler.c (modified) (3 diffs)
- trunk/libfreebobctl/src/xmlparser.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libfreebobctl/examples/test-freebobctl-osc.c
r72 r94 13 13 main(int argc, char **argv) { 14 14 char *url; 15 freebob_connection_info_t *test_info; 15 16 16 17 printf("Using freebob control library version: %s\n",freebobctl_get_version()); … … 23 24 url = argv[1]; 24 25 25 freebob_connection_info_t *test_info=freebobctl_get_connection_info_from_osc(url, 0); 26 // capture 27 printf("CAPTURE DIRECTION\n"); 28 test_info=freebobctl_get_connection_info_from_osc(url, 0); 29 freebobctl_print_connection_info(test_info); 26 30 freebobctl_free_connection_info(test_info); 27 28 //test_info=freebobctl_get_connection_info_from_xml_file(docname, 1); 29 //freebobctl_free_connection_info(test_info); 31 32 printf("PLAYBACK DIRECTION\n"); 33 test_info=freebobctl_get_connection_info_from_osc(url, 1); 34 freebobctl_print_connection_info(test_info); 35 freebobctl_free_connection_info(test_info); 36 30 37 31 38 trunk/libfreebobctl/src/ipchandler.c
r72 r94 33 33 34 34 void freebobctl_ipc_error(int num, const char *m, const char *path) { 35 printf("liblo server error %d in path %s: %s\n", num, path, m);35 fprintf(stderr,"liblo server error %d in path %s: %s\n", num, path, m); 36 36 }; 37 37 … … 53 53 int freebobctl_ipc_generic_handler(const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data) { 54 54 55 int i;55 /* int i; 56 56 57 printf("message received on path: <%s>\n", path);57 fprintf(stderr,"message received on path: <%s>\n", path); 58 58 for (i=0; i<argc; i++) { 59 printf("arg %d '%c' ", i, types[i]);59 fprintf(stderr,"arg %d '%c' ", i, types[i]); 60 60 lo_arg_pp(types[i], argv[i]); 61 printf("\n");61 fprintf(stderr,"\n"); 62 62 } 63 63 64 printf("\n"); 64 fprintf(stderr,"\n"); 65 */ 65 66 return 1; 66 67 … … 69 70 char * freebobctl_ipc_request_connection_info(char *url) { 70 71 char *buffer=NULL; 71 72 printf("requesting channel info from %s\n",url); 73 74 lo_server s = lo_server_new("7770", freebobctl_ipc_error);72 lo_server s; 73 74 fprintf(stderr,"requesting channel info from %s\n",url); 75 s = lo_server_new(NULL, freebobctl_ipc_error); 75 76 76 77 if(!s) { 78 fprintf(stderr,"Could not create server\n"); 77 79 return NULL; 78 80 } 79 81 80 82 /* add method that will match any path and args */ 83 fprintf(stderr,"adding generic handler...\n"); 81 84 lo_server_add_method(s, NULL, NULL, freebobctl_ipc_generic_handler, NULL); 82 85 86 fprintf(stderr,"adding /reponse handler...\n"); 83 87 lo_server_add_method(s, "/response", "s", freebobctl_ipc_response_handler, &buffer); 84 88 89 fprintf(stderr,"parsing address...\n"); 85 90 lo_address t = lo_address_new_from_url(url); 86 91 if(!t) { 92 fprintf(stderr,"Could not parse address\n"); 93 lo_server_free(s); 94 95 return NULL; 96 } 97 98 fprintf(stderr,"sending request... "); 87 99 if (lo_send(t, "/freebob/request", "s","connection_info") == -1) { 88 printf("OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t));100 fprintf(stderr,"OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); 89 101 lo_address_free(t); 90 102 lo_server_free(s); 91 103 return NULL; 92 104 } 93 105 106 fprintf(stderr,"waiting for response... "); 94 107 /* wait for the response, with timeout */ 95 108 if (lo_server_recv_noblock(s,5000)==0) { 96 printf("Timeout receiving response...\n");109 fprintf(stderr,"Timeout receiving response...\n"); 97 110 lo_address_free(t); 98 111 lo_server_free(s); 99 112 return NULL; 100 113 } 114 fprintf(stderr,"ok\n"); 115 116 fprintf(stderr,"freeing...\n"); 101 117 102 118 lo_address_free(t); 103 119 lo_server_free(s); 104 105 printf("done...\n");120 121 fprintf(stderr,"done...\n"); 106 122 return buffer; 107 123 trunk/libfreebobctl/src/xmlparser.c
r84 r94 54 54 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Position"))) { 55 55 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 56 printf("\t\tposition: %s\n", key);56 // printf("\t\tposition: %s\n", key); 57 57 stream_spec->position=strtol(key, (char **)NULL, 10); 58 58 xmlFree(key); … … 60 60 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Location"))) { 61 61 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 62 printf("\t\tlocation: %s\n", key);62 // printf("\t\tlocation: %s\n", key); 63 63 stream_spec->location=strtol(key, (char **)NULL, 10); 64 64 xmlFree(key); … … 66 66 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Format"))) { 67 67 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 68 printf("\t\tformat: %s\n", key);68 // printf("\t\tformat: %s\n", key); 69 69 stream_spec->format=strtol(key, (char **)NULL, 10); 70 70 xmlFree(key); … … 72 72 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Type"))) { 73 73 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 74 printf("\t\ttype: %s\n", key);74 // printf("\t\ttype: %s\n", key); 75 75 stream_spec->type=strtol(key, (char **)NULL, 10); 76 76 xmlFree(key); … … 78 78 if ((!xmlStrcmp(cur->name, (const xmlChar *)"DestinationPort"))) { 79 79 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 80 printf("\t\tdestination_port: %s\n", key);80 // printf("\t\tdestination_port: %s\n", key); 81 81 stream_spec->destination_port=strtol(key, (char **)NULL, 10); 82 82 xmlFree(key); … … 85 85 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Name"))) { 86 86 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 87 printf("\t\tname: %s\n", key);87 // printf("\t\tname: %s\n", key); 88 88 strncpy(stream_spec->name,key,FREEBOBCTL_MAX_NAME_LEN); 89 89 xmlFree(key); … … 171 171 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Id"))) { 172 172 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 173 printf("\tid: %s\n", key);173 // printf("\tid: %s\n", key); 174 174 connection_spec->id=strtol(key, (char **)NULL, 10); 175 175 xmlFree(key); … … 177 177 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Node"))) { 178 178 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 179 printf("\tnode: %s\n", key);179 // printf("\tnode: %s\n", key); 180 180 connection_spec->node=strtol(key, (char **)NULL, 10); 181 181 … … 184 184 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Port"))) { 185 185 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 186 printf("\tport: %s\n", key);186 // printf("\tport: %s\n", key); 187 187 connection_spec->port=strtol(key, (char **)NULL, 10); 188 188 xmlFree(key); … … 190 190 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Plug"))) { 191 191 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 192 printf("\tplug: %s\n", key);192 // printf("\tplug: %s\n", key); 193 193 connection_spec->plug=strtol(key, (char **)NULL, 10); 194 194 xmlFree(key); … … 196 196 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Dimension"))) { 197 197 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 198 printf("\tdimension: %s\n", key);198 // printf("\tdimension: %s\n", key); 199 199 connection_spec->dimension=strtol(key, (char **)NULL, 10); 200 200 xmlFree(key); … … 202 202 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Samplerate"))) { 203 203 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 204 printf("\tsamplerate: %s\n", key);204 // printf("\tsamplerate: %s\n", key); 205 205 connection_spec->samplerate=strtol(key, (char **)NULL, 10); 206 206 xmlFree(key); … … 240 240 cur = node->xmlChildrenNode; 241 241 while (cur != NULL) { 242 printf("%s\n",cur->name);242 // printf("%s\n",cur->name); 243 243 244 244 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Connection"))) { 245 245 connection_info->nb_connections=connection_info->nb_connections+1; 246 printf("nb_connections: %d\n", connection_info->nb_connections);246 // printf("nb_connections: %d\n", connection_info->nb_connections); 247 247 } 248 248 249 249 if ((!xmlStrcmp(cur->name, (const xmlChar *)"Direction"))) { 250 250 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 251 printf("\tdirection: %s\n", key);251 // printf("\tdirection: %s\n", key); 252 252 connection_info->direction=strtol(key, (char **)NULL, 10); 253 253 xmlFree(key); … … 354 354 connection_info=freebobctl_xmlparse_connectionset (doc, cur); 355 355 356 freebobctl_print_connection_info(connection_info);356 //freebobctl_print_connection_info(connection_info); 357 357 358 358 return connection_info;