Update of /cvsroot/playerstage/code/player/client_libs/libplayerc
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28583/client_libs/libplayerc
Modified Files:
dev_blackboard.c playerc.h
Log Message:
changed blackboard interface to use a string group id instead of an integer
Index: playerc.h
===================================================================
RCS file: /cvsroot/playerstage/code/player/client_libs/libplayerc/playerc.h,v
retrieving revision 1.250
retrieving revision 1.251
diff -C2 -d -r1.250 -r1.251
*** playerc.h 4 Feb 2008 18:59:43 -0000 1.250
--- playerc.h 6 Feb 2008 19:38:35 -0000 1.251
***************
*** 1154,1170 ****
/** @brief Subscribe to a key. If entry is none null it will be filled in
with the response. The caller is
* responsible for freeing it. */
! int playerc_blackboard_subscribe_to_key(playerc_blackboard_t *device, const
char* key, int32_t group_id, player_blackboard_entry_t** entry);
/** @brief Unsubscribe from a key. */
! int playerc_blackboard_unsubscribe_from_key(playerc_blackboard_t *device,
const char* key, int32_t group_id);
/** @brief Set an entry value. */
int playerc_blackboard_set_entry(playerc_blackboard_t *device,
player_blackboard_entry_t* entry);
! int playerc_blackboard_set_string(playerc_blackboard_t *device, const char*
key, uint32_t group_id, const char* value);
! int playerc_blackboard_set_int(playerc_blackboard_t *device, const char* key,
uint32_t group_id, const int value);
! int playerc_blackboard_set_double(playerc_blackboard_t *device, const char*
key, uint32_t group_id, const double value);
/** @} */
--- 1154,1170 ----
/** @brief Subscribe to a key. If entry is none null it will be filled in
with the response. The caller is
* responsible for freeing it. */
! int playerc_blackboard_subscribe_to_key(playerc_blackboard_t *device, const
char* key, const char* group, player_blackboard_entry_t** entry);
/** @brief Unsubscribe from a key. */
! int playerc_blackboard_unsubscribe_from_key(playerc_blackboard_t *device,
const char* key, const char* group);
/** @brief Set an entry value. */
int playerc_blackboard_set_entry(playerc_blackboard_t *device,
player_blackboard_entry_t* entry);
! int playerc_blackboard_set_string(playerc_blackboard_t *device, const char*
key, const char* group, const char* value);
! int playerc_blackboard_set_int(playerc_blackboard_t *device, const char* key,
const char* group, const int value);
! int playerc_blackboard_set_double(playerc_blackboard_t *device, const char*
key, const char* group, const double value);
/** @} */
Index: dev_blackboard.c
===================================================================
RCS file:
/cvsroot/playerstage/code/player/client_libs/libplayerc/dev_blackboard.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** dev_blackboard.c 30 Jan 2008 02:06:45 -0000 1.9
--- dev_blackboard.c 6 Feb 2008 19:38:35 -0000 1.10
***************
*** 54,60 ****
#include <sys/time.h>
! player_blackboard_entry_t *playerc_pack_blackboard_entry_string(const char*
key, uint32_t group_id, const char *str);
! player_blackboard_entry_t *playerc_pack_blackboard_entry_int(const char* key,
uint32_t group_id, const int i);
! player_blackboard_entry_t *playerc_pack_blackboard_entry_double(const char*
key, uint32_t group_id, const double d);
char *playerc_unpack_blackboard_entry_string(const player_blackboard_entry_t
*entry);
--- 54,60 ----
#include <sys/time.h>
! player_blackboard_entry_t *playerc_pack_blackboard_entry_string(const char*
key, const char* group, const char *str);
! player_blackboard_entry_t *playerc_pack_blackboard_entry_int(const char* key,
const char* group, const int i);
! player_blackboard_entry_t *playerc_pack_blackboard_entry_double(const char*
key, const char* group, const double d);
char *playerc_unpack_blackboard_entry_string(const player_blackboard_entry_t
*entry);
***************
*** 66,70 ****
int playerc_check_blackboard_entry_is_double(const player_blackboard_entry_t
*entry);
! player_blackboard_entry_t *playerc_pack_blackboard_entry_string(const char*
key, uint32_t group_id, const char *str)
{
struct timeval tv;
--- 66,70 ----
int playerc_check_blackboard_entry_is_double(const player_blackboard_entry_t
*entry);
! player_blackboard_entry_t *playerc_pack_blackboard_entry_string(const char*
key, const char* group, const char *str)
{
struct timeval tv;
***************
*** 75,83 ****
entry->type = PLAYERC_BLACKBOARD_DATA_TYPE_COMPLEX;
entry->subtype = PLAYERC_BLACKBOARD_DATA_SUBTYPE_STRING;
- entry->group_id = group_id;
entry->key_count = strlen(key) + 1;
entry->key = malloc(entry->key_count);
memcpy(entry->key, key, entry->key_count);
entry->data_count = strlen(str) + 1;
--- 75,86 ----
entry->type = PLAYERC_BLACKBOARD_DATA_TYPE_COMPLEX;
entry->subtype = PLAYERC_BLACKBOARD_DATA_SUBTYPE_STRING;
entry->key_count = strlen(key) + 1;
entry->key = malloc(entry->key_count);
memcpy(entry->key, key, entry->key_count);
+
+ entry->group_count = strlen(group) + 1;
+ entry->group = malloc(entry->group_count);
+ memcpy(entry->group, group, entry->group_count);
entry->data_count = strlen(str) + 1;
***************
*** 92,96 ****
}
! player_blackboard_entry_t *playerc_pack_blackboard_entry_int(const char* key,
uint32_t group_id, const int i)
{
struct timeval tv;
--- 95,99 ----
}
! player_blackboard_entry_t *playerc_pack_blackboard_entry_int(const char* key,
const char* group, const int i)
{
struct timeval tv;
***************
*** 101,109 ****
entry->type = PLAYERC_BLACKBOARD_DATA_TYPE_SIMPLE;
entry->subtype = PLAYERC_BLACKBOARD_DATA_SUBTYPE_INT;
- entry->group_id = group_id;
entry->key_count = strlen(key) + 1;
entry->key = malloc(entry->key_count);
memcpy(entry->key, key, entry->key_count);
entry->data_count = sizeof(int);
--- 104,115 ----
entry->type = PLAYERC_BLACKBOARD_DATA_TYPE_SIMPLE;
entry->subtype = PLAYERC_BLACKBOARD_DATA_SUBTYPE_INT;
entry->key_count = strlen(key) + 1;
entry->key = malloc(entry->key_count);
memcpy(entry->key, key, entry->key_count);
+
+ entry->group_count = strlen(group) + 1;
+ entry->group = malloc(entry->group_count);
+ memcpy(entry->group, group, entry->group_count);
entry->data_count = sizeof(int);
***************
*** 118,122 ****
}
! player_blackboard_entry_t *playerc_pack_blackboard_entry_double(const char*
key, uint32_t group_id, const double d)
{
struct timeval tv;
--- 124,128 ----
}
! player_blackboard_entry_t *playerc_pack_blackboard_entry_double(const char*
key, const char* group, const double d)
{
struct timeval tv;
***************
*** 127,135 ****
entry->type = PLAYERC_BLACKBOARD_DATA_TYPE_SIMPLE;
entry->subtype = PLAYERC_BLACKBOARD_DATA_SUBTYPE_DOUBLE;
- entry->group_id = group_id;
entry->key_count = strlen(key) + 1;
entry->key = malloc(entry->key_count);
memcpy(entry->key, key, entry->key_count);
entry->data_count = sizeof(double);
--- 133,144 ----
entry->type = PLAYERC_BLACKBOARD_DATA_TYPE_SIMPLE;
entry->subtype = PLAYERC_BLACKBOARD_DATA_SUBTYPE_DOUBLE;
entry->key_count = strlen(key) + 1;
entry->key = malloc(entry->key_count);
memcpy(entry->key, key, entry->key_count);
+
+ entry->group_count = strlen(group) + 1;
+ entry->group = malloc(entry->group_count);
+ memcpy(entry->group, group, entry->group_count);
entry->data_count = sizeof(double);
***************
*** 247,251 ****
// Subscribe to a blackboard key
! int playerc_blackboard_subscribe_to_key(playerc_blackboard_t* device, const
char* key, int32_t group_id, player_blackboard_entry_t** entry_out)
{
player_blackboard_entry_t req;
--- 256,260 ----
// Subscribe to a blackboard key
! int playerc_blackboard_subscribe_to_key(playerc_blackboard_t* device, const
char* key, const char* group, player_blackboard_entry_t** entry_out)
{
player_blackboard_entry_t req;
***************
*** 253,272 ****
req.key = strdup(key);
req.key_count = strlen(key) + 1;
! req.group_id = group_id;
if (playerc_client_request(device->info.client, &device->info,
PLAYER_BLACKBOARD_REQ_SUBSCRIBE_TO_KEY, &req, (void**)entry_out) < 0)
{
! free(req.key);
PLAYERC_ERR("failed to subscribe to blackboard key");
return -1;
}
! free(req.key);
return 0;
}
// Unsubscribe from a blackboard key
! int playerc_blackboard_unsubscribe_from_key(playerc_blackboard_t* device,
const char* key, int32_t group_id)
{
player_blackboard_entry_t req;
--- 262,297 ----
req.key = strdup(key);
req.key_count = strlen(key) + 1;
!
! req.group = strdup(group);
! req.group_count = strlen(group) + 1;
if (playerc_client_request(device->info.client, &device->info,
PLAYER_BLACKBOARD_REQ_SUBSCRIBE_TO_KEY, &req, (void**)entry_out) < 0)
{
! if (req.key != NULL)
! {
! free(req.key);
! }
! if (req.group != NULL)
! {
! free(req.group);
! }
PLAYERC_ERR("failed to subscribe to blackboard key");
return -1;
}
! if (req.key != NULL)
! {
! free(req.key);
! }
! if (req.group != NULL)
! {
! free(req.group);
! }
return 0;
}
// Unsubscribe from a blackboard key
! int playerc_blackboard_unsubscribe_from_key(playerc_blackboard_t* device,
const char* key, const char* group)
{
player_blackboard_entry_t req;
***************
*** 274,288 ****
req.key = strdup(key);
req.key_count = strlen(key) + 1;
! req.group_id = group_id;
if (playerc_client_request(device->info.client, &device->info,
PLAYER_BLACKBOARD_REQ_UNSUBSCRIBE_FROM_KEY, &req, NULL) < 0)
{
! free(req.key);
PLAYERC_ERR("failed to unsubscribe to blackboard key");
return -1;
}
! free(req.key);
return 0;
--- 299,329 ----
req.key = strdup(key);
req.key_count = strlen(key) + 1;
!
! req.group = strdup(group);
! req.group_count = strlen(group) + 1;
if (playerc_client_request(device->info.client, &device->info,
PLAYER_BLACKBOARD_REQ_UNSUBSCRIBE_FROM_KEY, &req, NULL) < 0)
{
! if (req.key)
! {
! free(req.key);
! }
! if (req.group)
! {
! free(req.group);
! }
PLAYERC_ERR("failed to unsubscribe to blackboard key");
return -1;
}
! if (req.key)
! {
! free(req.key);
! }
! if (req.group)
! {
! free(req.group);
! }
return 0;
***************
*** 302,325 ****
}
! int playerc_blackboard_set_string(playerc_blackboard_t *device, const char*
key, uint32_t group_id, const char* value)
{
! player_blackboard_entry_t *entry =
playerc_pack_blackboard_entry_string(key, group_id, value);
int result = playerc_blackboard_set_entry(device, entry);
free(entry);
return result;
}
! int playerc_blackboard_set_int(playerc_blackboard_t *device, const char* key,
uint32_t group_id, const int value)
{
! player_blackboard_entry_t *entry = playerc_pack_blackboard_entry_int(key,
group_id, value);
int result = playerc_blackboard_set_entry(device, entry);
free(entry);
return result;
}
! int playerc_blackboard_set_double(playerc_blackboard_t *device, const char*
key, uint32_t group_id, const double value)
{
! player_blackboard_entry_t *entry =
playerc_pack_blackboard_entry_double(key, group_id, value);
int result = playerc_blackboard_set_entry(device, entry);
free(entry);
return result;
--- 343,402 ----
}
! int playerc_blackboard_set_string(playerc_blackboard_t *device, const char*
key, const char* group, const char* value)
{
! player_blackboard_entry_t *entry =
playerc_pack_blackboard_entry_string(key, group, value);
int result = playerc_blackboard_set_entry(device, entry);
+ if (entry->key != NULL)
+ {
+ free(entry->key);
+ }
+ if (entry->group != NULL)
+ {
+ free(entry->group);
+ }
+ if (entry->data != NULL)
+ {
+ free(entry->data);
+ }
free(entry);
return result;
}
! int playerc_blackboard_set_int(playerc_blackboard_t *device, const char* key,
const char* group, const int value)
{
! player_blackboard_entry_t *entry = playerc_pack_blackboard_entry_int(key,
group, value);
int result = playerc_blackboard_set_entry(device, entry);
+ if (entry->key != NULL)
+ {
+ free(entry->key);
+ }
+ if (entry->group != NULL)
+ {
+ free(entry->group);
+ }
+ if (entry->data != NULL)
+ {
+ free(entry->data);
+ }
free(entry);
return result;
}
! int playerc_blackboard_set_double(playerc_blackboard_t *device, const char*
key, const char* group, const double value)
{
! player_blackboard_entry_t *entry =
playerc_pack_blackboard_entry_double(key, group, value);
int result = playerc_blackboard_set_entry(device, entry);
+ if (entry->key != NULL)
+ {
+ free(entry->key);
+ }
+ if (entry->group != NULL)
+ {
+ free(entry->group);
+ }
+ if (entry->data != NULL)
+ {
+ free(entry->data);
+ }
free(entry);
return result;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit