Update of /cvsroot/playerstage/code/player/client_libs/libplayerc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8151/libplayerc
Modified Files:
dev_simulation.c playerc.h
Log Message:
Added ability to get a property from the simulation interface
Index: dev_simulation.c
===================================================================
RCS file:
/cvsroot/playerstage/code/player/client_libs/libplayerc/dev_simulation.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** dev_simulation.c 21 Nov 2006 02:12:34 -0000 1.13
--- dev_simulation.c 20 Apr 2007 00:59:47 -0000 1.14
***************
*** 220,221 ****
--- 220,257 ----
}
+ // Get a property value */
+ int playerc_simulation_get_property(playerc_simulation_t *device,
+ char* name,
+ char* property,
+ void* value,
+ size_t value_len )
+ {
+ player_simulation_property_req_t req;
+
+ memset(&req, 0, sizeof(req));
+ strncpy(req.name, name, PLAYER_SIMULATION_IDENTIFIER_MAXLEN);
+ req.name[PLAYER_SIMULATION_IDENTIFIER_MAXLEN-1]='\0';
+ req.name_count = strlen(req.name) + 1;
+
+ strncpy(req.prop, property, PLAYER_SIMULATION_IDENTIFIER_MAXLEN);
+ req.prop[PLAYER_SIMULATION_IDENTIFIER_MAXLEN-1]='\0';
+ req.prop_count = strlen(req.prop) + 1;
+
+ if( value_len > PLAYER_SIMULATION_PROPERTY_DATA_MAXLEN )
+ {
+ PLAYER_WARN2( "Simulation property data exceeds maximum length (%d/%d
bytes).",
+ value_len, PLAYER_SIMULATION_PROPERTY_DATA_MAXLEN );
+ value_len = PLAYER_SIMULATION_PROPERTY_DATA_MAXLEN;
+ }
+
+ req.value_count = value_len;
+
+ if( playerc_client_request(device->info.client, &device->info,
+ PLAYER_SIMULATION_REQ_GET_PROPERTY,
+ &req, &req, sizeof(req)) < 0)
+ return -1;
+
+ memcpy(value, req.value, value_len);
+
+ return 0;
+ }
Index: playerc.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/playerc.h,v
retrieving revision 1.220
retrieving revision 1.221
diff -C2 -d -r1.220 -r1.221
*** playerc.h 14 Mar 2007 16:41:51 -0000 1.220
--- playerc.h 20 Apr 2007 00:59:47 -0000 1.221
***************
*** 2864,2867 ****
--- 2864,2874 ----
void* value,
size_t value_len);
+
+ /** @brief Get a property value */
+ int playerc_simulation_get_property(playerc_simulation_t *device,
+ char* name,
+ char* property,
+ void* value,
+ size_t value_len);
/** @} */
/***************************************************************************/
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit