Update of /cvsroot/playerstage/code/player/server/drivers/rfid
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10946/server/drivers/rfid
Modified Files:
.cvsignore insideM300.cc phidgetRFID.cc rfi341_protocol.cc
sickrfi341.cc skyetekM1.cc
Log Message:
applied Toby's patch to replace fixed-size arrays
Index: .cvsignore
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/rfid/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** .cvsignore 17 Sep 2007 02:18:56 -0000 1.2
--- .cvsignore 1 Nov 2007 22:16:22 -0000 1.3
***************
*** 3,4 ****
--- 3,6 ----
.deps
*.la
+ .libs
+ *.lo
Index: skyetekM1.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/rfid/skyetekM1.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** skyetekM1.cc 23 Aug 2007 19:58:48 -0000 1.6
--- skyetekM1.cc 1 Nov 2007 22:16:22 -0000 1.7
***************
*** 87,90 ****
--- 87,91 ----
// Includes needed for player
#include <libplayercore/playercore.h>
+ #include <libplayerxdr/playerxdr.h>
#define DEFAULT_RFID_PORT "/dev/ttyS0"
***************
*** 123,126 ****
--- 124,128 ----
// RFID interface
player_rfid_data_t Data;
+ int allocated_tags;
player_rfid_data_t Cmd;
***************
*** 166,170 ****
SkyetekM1::SkyetekM1 (ConfigFile* cf, int section)
: Driver (cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN,
! PLAYER_RFID_CODE)
{
this->portName = cf->ReadString (section, "port", DEFAULT_RFID_PORT);
--- 168,172 ----
SkyetekM1::SkyetekM1 (ConfigFile* cf, int section)
: Driver (cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN,
! PLAYER_RFID_CODE), allocated_tags(0)
{
this->portName = cf->ReadString (section, "port", DEFAULT_RFID_PORT);
***************
*** 174,177 ****
--- 176,182 ----
this->selectTagMultiple = 1;
+ memset(&Data, 0, sizeof(Data));
+ memset(&Cmd, 0, sizeof(Cmd));
+
return;
}
***************
*** 179,182 ****
--- 184,189 ----
SkyetekM1::~SkyetekM1()
{
+ player_rfid_data_t_cleanup(&Data);
+ player_rfid_data_t_cleanup(&Cmd);
}
***************
*** 439,444 ****
if (response_buf[0] == 0x02)
{
this->Data.tags[this->Data.tags_count].type =
TID[0];
! this->Data.tags[this->Data.tags_count].guid_count = 8;
int j;
for (j = 0; j < 9; j++)
--- 446,461 ----
if (response_buf[0] == 0x02)
{
+ if (this->Data.tags_count >= this->allocated_tags)
+ {
+ this->allocated_tags = this->Data.tags_count+1;
+ this->Data.tags =
(player_rfid_tag_t*)realloc(this->Data.tags,sizeof(this->Data.tags[0])*this->allocated_tags);
+ }
this->Data.tags[this->Data.tags_count].type =
TID[0];
! if (this->Data.tags[this->Data.tags_count].guid_count
!= 8);
! {
!
this->Data.tags[this->Data.tags_count].guid_count = 8;
! this->Data.tags[this->Data.tags_count].guid =
(char*)malloc(8);
! }
!
int j;
for (j = 0; j < 9; j++)
Index: sickrfi341.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/rfid/sickrfi341.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** sickrfi341.cc 23 Aug 2007 19:58:48 -0000 1.4
--- sickrfi341.cc 1 Nov 2007 22:16:22 -0000 1.5
***************
*** 89,92 ****
--- 89,93 ----
#include "rfi341_protocol.h"
#include <libplayercore/playercore.h>
+ #include <libplayerxdr/playerxdr.h>
#define DEFAULT_RFI341_PORT "/dev/ttyS0"
***************
*** 230,233 ****
--- 231,235 ----
&data, sizeof (data), NULL);
+ player_rfid_data_t_cleanup(&data);
nanosleep (&sleepTime, NULL);
}
Index: insideM300.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/rfid/insideM300.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** insideM300.cc 23 Aug 2007 19:58:48 -0000 1.5
--- insideM300.cc 1 Nov 2007 22:16:22 -0000 1.6
***************
*** 153,156 ****
--- 153,157 ----
// RFID interface
player_rfid_data_t Data;
+ unsigned int allocated_tags;
player_rfid_data_t Cmd;
***************
*** 205,209 ****
InsideM300::InsideM300 (ConfigFile* cf, int section)
: Driver (cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN,
! PLAYER_RFID_CODE)
{
this->portName = cf->ReadString (section, "port", DEFAULT_RFID_PORT);
--- 206,210 ----
InsideM300::InsideM300 (ConfigFile* cf, int section)
: Driver (cf, section, false, PLAYER_MSGQUEUE_DEFAULT_MAXLEN,
! PLAYER_RFID_CODE), allocated_tags(0)
{
this->portName = cf->ReadString (section, "port", DEFAULT_RFID_PORT);
***************
*** 213,216 ****
--- 214,219 ----
this->selectTagMultiple = 1;
+ memset(&Data,0, sizeof(Data));
+
return;
}
***************
*** 221,224 ****
--- 224,228 ----
InsideM300::~InsideM300()
{
+ free(Data.tags);
}
***************
*** 672,675 ****
--- 676,684 ----
case STATUS_OK:
{
+ if (this->Data.tags_count >=
this->allocated_tags)
+ {
+ this->allocated_tags =
this->Data.tags_count+1;
+ this->Data.tags =
(player_rfid_tag_t*)realloc(this->Data.tags,sizeof(this->Data.tags[0])*this->allocated_tags);
+ }
this->Data.tags[this->Data.tags_count].type =
chipAnswer[1];
this->Data.tags[this->Data.tags_count].guid_count = 8;
***************
*** 747,750 ****
--- 756,764 ----
globalChipAnswer[i] = chipAnswer[i+2];
+ if (this->Data.tags_count >= this->allocated_tags)
+ {
+ this->allocated_tags = this->Data.tags_count+1;
+ this->Data.tags =
(player_rfid_tag_t*)realloc(this->Data.tags,sizeof(this->Data.tags[0])*this->allocated_tags);
+ }
this->Data.tags[this->Data.tags_count].type =
chipAnswer[1];
this->Data.tags[this->Data.tags_count].guid_count = 8;
Index: rfi341_protocol.cc
===================================================================
RCS file:
/cvsroot/playerstage/code/player/server/drivers/rfid/rfi341_protocol.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rfi341_protocol.cc 15 Mar 2007 12:06:45 -0000 1.2
--- rfi341_protocol.cc 1 Nov 2007 22:16:22 -0000 1.3
***************
*** 371,374 ****
--- 371,375 ----
player_rfid_data_t player_data;
player_data.tags_count = number_of_tags;
+ player_data.tags = (player_rfid_tag_t*)calloc(player_data.tags_count,
sizeof(player_data.tags[0]));
player_rfid_tag_t tag;
***************
*** 377,380 ****
--- 378,382 ----
tag.type = 1;
tag.guid_count = 8;
+ tag.guid = (char*)calloc(tag.guid_count, sizeof(tag.guid[0]));
for (int j = 0; j < 8; j++)
{
Index: phidgetRFID.cc
===================================================================
RCS file: /cvsroot/playerstage/code/player/server/drivers/rfid/phidgetRFID.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** phidgetRFID.cc 18 Oct 2007 22:02:16 -0000 1.4
--- phidgetRFID.cc 1 Nov 2007 22:16:22 -0000 1.5
***************
*** 371,374 ****
--- 371,376 ----
int ledstate;
player_rfid_data_t data_rfid;
+ data_rfid.tags = new player_rfid_tag_t[1];
+ data_rfid.tags[0].guid = new char[8];
if (tagControl.rfid_present==rfid) {
tagPresent=tagControl.tagPresent;
***************
*** 407,410 ****
--- 409,414 ----
Publish(rfid_id, PLAYER_MSGTYPE_DATA, PLAYER_RFID_DATA_TAGS,
(unsigned char*)&data_rfid, sizeof(player_rfid_data_t), NULL);
}
+ delete [] data_rfid.tags[0].guid;
+ delete [] data_rfid.tags;
//point to calculate how much to sleep, call nanosleep, after sleep
restart the timer
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit