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
mixed
rmp
usb_packet.h
1
/*
2
* Player - One Hell of a Robot Server
3
* Copyright (C) 2009
4
* Eric Grele and Goutham Mallapragda.
5
*
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
11
*
12
* This program 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
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*
21
*/
22
23
#ifndef _USB_PACKET_H_
24
#define _USB_PACKET_H_
25
26
#include "canio.h"
27
#include <libplayercommon/playercommon.h>
28
29
30
struct
usb_struct
{
31
unsigned
char
usb_message_header;
32
unsigned
char
usb_command_identifier;
33
unsigned
char
command_type;
34
unsigned
char
unused0;
35
unsigned
char
unused1;
36
unsigned
char
unused2;
37
unsigned
short
can_message_header;
38
unsigned
char
unused3;
39
unsigned
char
can_message[8];
40
unsigned
char
usb_message_checksum;
41
};
42
43
typedef
union
usb_packet
{
44
unsigned
char
pkt_data[18];
45
struct
usb_struct
pkt;
46
}
usb_packet_t
;
47
48
class
USBpacket
{
49
50
private
:
51
unsigned
short
make_can_header(
long
id
,
unsigned
int
dlc,
unsigned
int
flags );
52
unsigned
char
compute_checksum();
53
54
55
public
:
56
57
typedef
enum
{ CANA_DEV, USB_CMD_RESET } CommandType;
58
59
usb_packet_t
pkt;
60
61
USBpacket
();
62
USBpacket
(
const
CanPacket
&pkt );
63
operator
CanPacket
();
64
bool
check();
65
66
void
print();
67
68
};
69
70
71
class
USBIO
{
72
private
:
73
int
fd;
74
bool
synced;
75
public
:
76
USBIO
() { fd = -1; synced =
false
; }
77
int
Init(
const
char
*dev);
78
int
ReadPacket(
CanPacket
*pkt);
79
int
SyncRead(
USBpacket
&p );
80
int
WritePacket(
CanPacket
&pkt);
81
int
Shutdown();
82
};
83
84
#endif
CanPacket
Definition
canio.h:46
USBIO
Definition
usb_packet.h:71
USBpacket
Definition
usb_packet.h:48
usb_struct
Definition
usb_packet.h:30
usb_packet
Definition
usb_packet.h:43
Generated on Thu Jul 25 2024 00:00:00 for Player by
1.12.0