handler.h
1 /*
2  * Based on code from 'iw':
3  *
4  * Copyright (c) 2007, 2008 Johannes Berg
5  * Copyright (c) 2007 Andy Lutomirski
6  * Copyright (c) 2007 Mike Kershaw
7  * Copyright (c) 2008-2009 Luis R. Rodriguez
8  *
9  * Permission to use, copy, modify, and/or distribute this software for any
10  * purpose with or without fee is hereby granted, provided that the above
11  * copyright notice and this permission notice appear in all copies.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  *
21  */
22 
23 /*
24  * Integration as a player driver was done by Michael Bienia.
25  *
26  * Copyright © 2010 Michael Bienia <m.bienia@stud.fh-dortmund.de>
27  *
28  */
29 
30 #ifndef WLANSCAN_HANDLER_H
31 #define WLANSCAN_HANDLER_H
32 
33 #include <asm/types.h>
34 #include <netlink/handlers.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
41  const char *group;
42  int id; /* return value */
43  };
44 
45  struct wait_event_args {
46  int n_cmds;
47  const unsigned int *cmds;
48  unsigned int devidx;
49  unsigned int cmd; /* return value */
50  };
51 
52  /* Scan handler */
53  extern int scan_handler(struct nl_msg *msg, void *arg);
54 
55  /* */
56  extern int family_handler(struct nl_msg *msg, void *arg);
57  extern int no_seq_check(struct nl_msg *msg, void *arg);
58  extern int wait_event(struct nl_msg *msg, void *arg);
59 
60  /* Generic callback handler */
61  extern int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err, void *arg);
62  extern int ack_handler(struct nl_msg *msg, void *arg);
63  extern int finish_handler(struct nl_msg *msg, void *arg);
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 #endif
#define PLAYER_ACTARRAY_ACTSTATE_STALLED
Stalled state code.
Definition: player_interfaces.h:3784
Definition: handler.h:45
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:158
#define PLAYER_CAMERA_FORMAT_RGB565
Image format : 16-bit color (5 bits R, 6 bits G, 5 bits B).
Definition: player_interfaces.h:2940
Generic message header.
Definition: player.h:160
#define PLAYER_CAMERA_FORMAT_RGB888
Image format : 24-bit color (8 bits R, 8 bits G, 8 bits B).
Definition: player_interfaces.h:2942
#define PLAYER_GRIPPER_STATE_CLOSED
Gripper state: closed.
Definition: player_interfaces.h:401
uint8_t type
Message type; must be one of PLAYER_MSGTYPE_*.
Definition: player.h:165
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:73
const char * ReadString(int section, const char *name, const char *value)
Read a string value.
#define PLAYER_ACTARRAY_ACTSTATE_BRAKED
Braked state code.
Definition: player_interfaces.h:3782
#define PLAYER_PTZ_POSITION_CONTROL
Control mode, for use with PLAYER_PTZ_REQ_CONTROL_MODE.
Definition: player_interfaces.h:1221
#define PLAYER_ACTARRAY_ACTSTATE_IDLE
Idle state code.
Definition: player_interfaces.h:3778
uint8_t subtype
Message subtype; interface specific.
Definition: player.h:167
const char * ReadTupleString(int section, const char *name, int index, const char *value)
Read a string from a tuple field.
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:94
#define PLAYER_CAMERA_FORMAT_MONO16
Image format : 16-bit monochrome (network byte order).
Definition: player_interfaces.h:2938
#define PLAYER_MSGTYPE_RESP_ACK
A positive response message.
Definition: player.h:111
#define PLAYER_ACTARRAY_TYPE_ROTARY
Rotary type code.
Definition: player_interfaces.h:3789
#define PLAYER_GRIPPER_STATE_OPEN
Gripper state: open.
Definition: player_interfaces.h:399
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
#define PLAYER_MSGTYPE_REQ
A request message.
Definition: player.h:105
#define PLAYER_GRIPPER_STATE_ERROR
Gripper state: error.
Definition: player_interfaces.h:405
Definition: handler.h:40
#define PLAYER_MSGTYPE_RESP_NACK
A negative response message.
Definition: player.h:124
#define PLAYER_GRIPPER_STATE_MOVING
Gripper state: moving.
Definition: player_interfaces.h:403
#define PLAYER_ACTARRAY_ACTSTATE_MOVING
Moving state code.
Definition: player_interfaces.h:3780
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
int GetTupleCount(int section, const char *name)
Get the number of values in a tuple.
#define PLAYER_ACTARRAY_TYPE_LINEAR
Linear type code.
Definition: player_interfaces.h:3787
Class for loading configuration file information.
Definition: configfile.h:195
virtual int Setup()
Initialize the driver.
Definition: driver.h:385
A device address.
Definition: player.h:144
An autopointer for the message queue.
Definition: message.h:72
#define PLAYER_PTZ_VELOCITY_CONTROL
Control mode, for use with PLAYER_PTZ_REQ_CONTROL_MODE.
Definition: player_interfaces.h:1219
#define PLAYER_ERROR1(msg, a)
Error message macros.
Definition: error.h:81
#define PLAYER_CAMERA_COMPRESS_RAW
Compression method: raw.
Definition: player_interfaces.h:2945
#define PLAYER_ERROR(msg)
Error message macros.
Definition: error.h:80
#define PLAYER_CAMERA_FORMAT_MONO8
Image format : 8-bit monochrome.
Definition: player_interfaces.h:2936
double timestamp
Time associated with message contents (seconds since epoch)
Definition: player.h:169
uint32_t size
Size in bytes of the payload to follow.
Definition: player.h:173
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:98
virtual int Shutdown()
Finalize the driver.
Definition: driver.h:392
Base class for all drivers.
Definition: driver.h:107
#define PLAYER_MSGTYPE_SYNCH
A synch message.
Definition: player.h:116
player_devaddr_t addr
Device to which this message pertains.
Definition: player.h:163
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:75
#define PLAYER_CAMERA_COMPRESS_JPEG
Compression method: jpeg.
Definition: player_interfaces.h:2947