Update of /cvsroot/playerstage/code/player/client_libs/libplayerc
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18140/client_libs/libplayerc

Modified Files:
        device.c playerc.h 
Log Message:
applied patch 1709455 from geoff biggs adding support for generic properties to 
interfaces


Index: playerc.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/playerc.h,v
retrieving revision 1.221
retrieving revision 1.222
diff -C2 -d -r1.221 -r1.222
*** playerc.h   20 Apr 2007 00:59:47 -0000      1.221
--- playerc.h   29 Apr 2007 07:18:42 -0000      1.222
***************
*** 819,822 ****
--- 819,840 ----
  int playerc_device_hascapability(playerc_device_t *device, uint32_t type, 
uint32_t subtype);
  
+ /** @brief Request an integer property */
+ int playerc_device_get_intprop(playerc_device_t *device, char *property, 
int32_t *value);
+ 
+ /** @brief Set an integer property */
+ int playerc_device_set_intprop(playerc_device_t *device, char *property, 
int32_t value);
+ 
+ /** @brief Request a double property */
+ int playerc_device_get_dblprop(playerc_device_t *device, char *property, 
double *value);
+ 
+ /** @brief Set a double property */
+ int playerc_device_set_dblprop(playerc_device_t *device, char *property, 
double value);
+ 
+ /** @brief Request a string property */
+ int playerc_device_get_strprop(playerc_device_t *device, char *property, char 
**value);
+ 
+ /** @brief Set a string property */
+ int playerc_device_set_strprop(playerc_device_t *device, char *property, 
const char *value);
+ 
  
  /** @} */

Index: device.c
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/device.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** device.c    6 May 2006 23:08:58 -0000       1.12
--- device.c    29 Apr 2007 07:18:42 -0000      1.13
***************
*** 2,6 ****
   *  Player - One Hell of a Robot Server
   *  Copyright (C) Andrew Howard 2002-2003
!  *                      
   *
   *  This program is free software; you can redistribute it and/or modify
--- 2,6 ----
   *  Player - One Hell of a Robot Server
   *  Copyright (C) Andrew Howard 2002-2003
!  *
   *
   *  This program is free software; you can redistribute it and/or modify
***************
*** 22,26 ****
   *  Player - One Hell of a Robot Server
   *  Copyright (C) Andrew Howard 2003
!  *                      
   *
   *  This library is free software; you can redistribute it and/or
--- 22,26 ----
   *  Player - One Hell of a Robot Server
   *  Copyright (C) Andrew Howard 2003
!  *
   *
   *  This library is free software; you can redistribute it and/or
***************
*** 83,88 ****
  int playerc_device_subscribe(playerc_device_t *device, int access)
  {
!   if (playerc_client_subscribe(device->client, device->addr.interf, 
!                                device->addr.index, access, 
                                 device->drivername, 
sizeof(device->drivername)) != 0)
      return -1;
--- 83,88 ----
  int playerc_device_subscribe(playerc_device_t *device, int access)
  {
!   if (playerc_client_subscribe(device->client, device->addr.interf,
!                                device->addr.index, access,
                                 device->drivername, 
sizeof(device->drivername)) != 0)
      return -1;
***************
*** 97,102 ****
  {
    device->subscribed = 0;
!   return playerc_client_unsubscribe(device->client, 
!                                     device->addr.interf, 
                                      device->addr.index);
  }
--- 97,102 ----
  {
    device->subscribed = 0;
!   return playerc_client_unsubscribe(device->client,
!                                     device->addr.interf,
                                      device->addr.index);
  }
***************
*** 112,113 ****
--- 112,219 ----
                              NULL, (void*)&capreq, sizeof(capreq)) >= 0 ? 1 : 
0;
  }
+ 
+ int playerc_device_get_intprop(playerc_device_t *device, char *property, 
int32_t *value)
+ {
+   int result = 0;
+ 
+   player_intprop_req_t req;
+   req.key = property;
+   req.key_count = strlen (property) + 1;
+   req.value = 0;
+ 
+   if((result = playerc_client_request(device->client, device,
+                             PLAYER_GET_INTPROP_REQ, &req, &req, sizeof(req))) 
< 0)
+     return result;
+ 
+   *value = req.value;
+   return 0;
+ }
+ 
+ int playerc_device_set_intprop(playerc_device_t *device, char *property, 
int32_t value)
+ {
+   int result = 0;
+ 
+   player_intprop_req_t req;
+   req.key = property;
+   req.key_count = strlen (property) + 1;
+   req.value = value;
+ 
+   if((result = playerc_client_request(device->client, device,
+                             PLAYER_SET_INTPROP_REQ, &req, NULL, 0)) < 0)
+     return result;
+ 
+   return 0;
+ }
+ 
+ int playerc_device_get_dblprop(playerc_device_t *device, char *property, 
double *value)
+ {
+   int result = 0;
+ 
+   player_dblprop_req_t req;
+   req.key = property;
+   req.key_count = strlen (property) + 1;
+   req.value = 0;
+ 
+   if((result = playerc_client_request(device->client, device,
+                             PLAYER_GET_DBLPROP_REQ, &req, &req, sizeof(req))) 
< 0)
+     return result;
+ 
+   *value = req.value;
+   return 0;
+ }
+ 
+ int playerc_device_set_dblprop(playerc_device_t *device, char *property, 
double value)
+ {
+   int result = 0;
+ 
+   player_dblprop_req_t req;
+   req.key = property;
+   req.key_count = strlen (property) + 1;
+   req.value = value;
+ 
+   if((result = playerc_client_request(device->client, device,
+                             PLAYER_SET_DBLPROP_REQ, &req, NULL, 0)) < 0)
+     return result;
+ 
+   return 0;
+ }
+ 
+ int playerc_device_get_strprop(playerc_device_t *device, char *property, char 
**value)
+ {
+   int result = 0;
+ 
+   player_strprop_req_t req;
+   req.key = property;
+   req.key_count = strlen (property) + 1;
+   req.value = NULL;
+   req.value_count = 0;
+ 
+   if((result = playerc_client_request(device->client, device,
+                             PLAYER_GET_STRPROP_REQ, &req, &req, sizeof(req))) 
< 0)
+     return result;
+ 
+   if (((*value) = strdup (req.value)) == NULL)
+   {
+     PLAYER_ERROR ("Failed to allocate memory to store property value");
+     return -1;
+   }
+ 
+   return 0;
+ }
+ 
+ int playerc_device_set_strprop(playerc_device_t *device, char *property, 
const char *value)
+ {
+   int result = 0;
+ 
+   player_strprop_req_t req;
+   req.key = property;
+   req.key_count = strlen (property) + 1;
+   req.value = value;
+   req.value_count = strlen (value) + 1;
+ 
+   if((result = playerc_client_request(device->client, device,
+                             PLAYER_SET_STRPROP_REQ, &req, NULL, 0)) < 0)
+     return result;
+ 
+   return 0;
+ }


-------------------------------------------------------------------------
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

Reply via email to