Player
Frontpage
Contents
User
Installation
Quick start
Supported devices
Tutorials
Utilities
Client libraries
FAQ
Help
Developer
Architecture
libplayercore
libplayerinterface
interfaces
libplayerdrivers
drivers
libplayercommon
libplayersd
libplayertcp
libplayerxdr
TODO
Online
Homepage
Download
Project
Bugs
Help
server
drivers
rfid
rfi341_protocol.h
1
/*
2
* Player - One Hell of a Robot Server
3
* Copyright (C) 2007
4
* Nico Blodow and Radu Bogdan Rusu
5
*
6
*
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
11
*
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
16
*
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
/*
23
Desc: Driver for the SICK RFI341 unit
24
Author: Nico Blodow and Radu Bogdan Rusu
25
Date: 9 Mar 2007
26
CVS: $Id$
27
*/
28
#include <termios.h>
29
#include <sys/types.h>
30
#include <libplayercore/playercore.h>
31
32
#define BUF_SIZE 1024
33
34
#define STX 0x02
35
#define ETX 0x03
36
#define ACK 0x06
37
#define NAK 0x15
38
#define SYN 0x16
39
#define ESC 0x18
40
42
class
rfi341_protocol
43
{
44
public
:
45
rfi341_protocol
(
const
char
* port_name,
int
debug_mode);
46
47
// Creates socket, connects
48
// Connects first at 'connect_speed'
49
int
Connect (
int
connect_speed);
50
51
// but for transfer, we might want to use a different 'transfer_speed'
52
int
SetupSensor (
int
transfer_speed);
53
54
int
Disconnect ();
55
56
// assembles a command and sends it on the wire
57
int
SendCommand (
const
char
* cmd);
58
// reads the result of a query from the device
59
int
ReadResult ();
60
player_rfid_data_t ReadTags ();
61
62
private
:
63
// assembles STX's, message, checksum ready to be sent. Cool.
64
int
assemblecommand (
unsigned
char
* command,
int
len);
65
66
int
number_of_tags;
67
char
**tags;
68
69
// Initial serial port attributes
70
struct
termios initial_options;
71
72
// Internal Parameters:
73
int
verbose;
74
int
fd;
75
const
char
* port;
76
int
portspeed;
77
78
// for reading:
79
unsigned
char
buffer[4096];
80
unsigned
int
bufferlength;
81
int
checksum;
82
83
// for sending:
84
unsigned
char
command[BUF_SIZE];
85
int
commandlength;
86
};
rfi341_protocol
Definition
rfi341_protocol.h:43
Generated on Thu Jul 25 2024 00:00:00 for Player by
1.12.0