obex_main.h

来自「sparc硬件平台上的红外协议」· C头文件 代码 · 共 128 行

H
128
字号
/********************************************************************* *                 * Filename:      obex_main.h * Version:       0.9 * Description:    * Status:        Experimental. * Author:        Dag Brattli <dagb@cs.uit.no> * Created at:    Mon Jul 20 22:28:23 1998 * CVS ID:        $Id: obex_main.h,v 1.24 2006/05/04 11:24:21 holtmann Exp $ *  *     Copyright (c) 1999, 2000 Pontus Fuchs, All Rights Reserved. *     Copyright (c) 1998, 1999, 2000 Dag Brattli, All Rights Reserved. *       *     This library is free software; you can redistribute it and/or *     modify it under the terms of the GNU Lesser General Public *     License as published by the Free Software Foundation; either *     version 2 of the License, or (at your option) any later version. * *     This library is distributed in the hope that it will be useful, *     but WITHOUT ANY WARRANTY; without even the implied warranty of *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *     Lesser General Public License for more details. * *     You should have received a copy of the GNU Lesser General Public *     License along with this library; if not, write to the Free Software *     Foundation, Inc., 59 Temple Place, Suite 330, Boston,  *     MA  02111-1307  USA *      ********************************************************************/#ifndef OBEX_MAIN_H#define OBEX_MAIN_H#include <time.h>#include "types.h"#include <sys/time.h>#include <sys/types.h>#include "../irda.h"/* Forward decl */typedef struct obex obex_t;#ifdef TRUE#undef TRUE#endif#ifdef FALSE#undef FALSE#endif#define	TRUE		1#define FALSE		0#define obex_return_if_fail(test)	do { if (!(test)) return; } while(0);#define obex_return_val_if_fail(test, val)	do { if (!(test)) return val; } while(0);#include "obex_const.h"#include "obex_object.h"#include "obex_transport.h"#include "databuffer.h"#define IRCP_DEBUG 0 #ifdef IRCP_DEBUG#define DEBUG(n, format, args...) if(n >IRCP_DEBUG) printf("%s(): " format, __FUNCTION__ , ##args)#else#define DEBUG(n, format, args...)#endif //IRCP_DEBUG#define OBEX_VERSION		0x10      /* OBEX Protocol Version 1.1 */// Note that this one is also defined in obex.htypedef void (*obex_event_t)(obex_t *handle, obex_object_t *obj, int mode, int event, int obex_cmd, int obex_rsp);#define MODE_SRV	0x80#define MODE_CLI	0x00enum{	STATE_IDLE,	STATE_START,	STATE_SEND,	STATE_REC,};struct obex {	uint16_t mtu_tx;			/* Maximum OBEX TX packet size */	uint16_t mtu_rx;			/* Maximum OBEX RX packet size */	uint16_t mtu_tx_max;		/* Maximum TX we can accept */    	unsigned int state;		int keepserver;		/* Keep server alive */	int filterhint;		/* Filter devices based on hint bits */	int filterias;		/* Filter devices based on IAS entry */	buf_t *tx_msg;		/* Reusable transmit message */	buf_t *rx_msg;		/* Reusable receive message */	obex_object_t	*object;	/* Current object being transfered */      	obex_event_t	eventcb;	/* Event-callback */	obex_transport_t trans;		/* Transport being used */	obex_ctrans_t ctrans;	obex_interface_t *interfaces;	/* Array of discovered interfaces */	int interfaces_number;		/* Number of discovered interfaces */	void * userdata;		/* For user */};int obex_create_socket(obex_t *self, int domain);//int obex_delete_socket(obex_t *self, int fd);void obex_deliver_event(obex_t *self, int event, int cmd, int rsp, int del);int obex_data_indication(obex_t *self, uint8_t *buf, int buflen);void obex_response_request(obex_t *self, uint8_t opcode);int obex_data_request(obex_t *self, buf_t *msg, int opcode);int obex_cancelrequest(obex_t *self, int nice);#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?