Linux下基于bluez与obex的服务

上传人:ss****gk 文档编号:209184416 上传时间:2021-11-09 格式:DOC 页数:6 大小:75KB
返回 下载 相关 举报
Linux下基于bluez与obex的服务_第1页
第1页 / 共6页
Linux下基于bluez与obex的服务_第2页
第2页 / 共6页
Linux下基于bluez与obex的服务_第3页
第3页 / 共6页
Linux下基于bluez与obex的服务_第4页
第4页 / 共6页
Linux下基于bluez与obex的服务_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《Linux下基于bluez与obex的服务》由会员分享,可在线阅读,更多相关《Linux下基于bluez与obex的服务(6页珍藏版)》请在金锄头文库上搜索。

1、Linux下基于bluez与obex的服务Linux is based on the service of bluez and obexClassification: bluez/obex 2009-08-1017:1260 reading review (0) collects reportsA service side need to give each other the OBEX Object Push service charinel, so before I open the server needs to determine the service registry to SDP

2、 server, use sdptool registered under Linux commands to the service: sdptool add opush;OBEX Init () is used to initialize an obex instance handle;Argl: OBEX TRANS BLUETOOTH is used to declare the transport protocol as bluetooth;Arg2: the callback function.Arg3: flag = OBEX FL KEEPSERVER, and after r

3、eceiving the request, the server can continue to receive requests from other die nts;OBEX SetUserData () sets the users own variable, which is entirely dependent on the user himself;3. BtOBEX ServerRegister () ; A server-side function dedicated to the bluetooth protocol that listens for requests sen

4、t by the client;The internal function creates a socket (call socket(AF BLUETOOTH SOCK STREAM, BTPROTO RFCOMM), bind the socket to the local bluetooth address, convert the socket to listen sockt, after the socket to listen on port from the client on the connection request;The 0BEX_Hand1eInput () func

5、tion is used to read and process the received data, which will block if no data arrives.This function is called the selet () function, parameters to the system registration handle client sockt with server-side sockt, let the system to monitor the events on the socket, if is the data to the server so

6、cket, is called the accept () function for the client to create a new sockt,If the flag of 0BEX_Init () is not set to OBEX_FL_KEEPSERVER, then the service terminal socket is turned off and other client connections are forbidden;(? : the accept () for the client to create a new socket, and returns it

7、s descriptor, then the newly created socket port is to redistribute or the original channel from the server, if the redistribution, only register the service on the server channel, if there is no redistribution, so is more than one client to use the same channel? 0 (studying studying) o.5. The callb

8、ack: OBEX_EV_ACCEPTHINT;OBEX_ServerAccept () returns the socket for the above clientFunction to create a internal obex instance handle, and copies the server handle parameters to the handle, obtain the server handle fd (accept the client to create a socket), after removing the server itself of fd;Th

9、is function also sets the callback function and Userdata for the newly created obex instance handleSo far, have the server for the client to create a completely independent obex instance handle, then the server operations are made by the handle logo, the server socket continued to monitor other clie

10、nt connection request;Callback: OBEX EV REQDONE: OBEX CMD CONNECT:10. callback: OBEX_EV_REQHINT a request is coming;Invoke OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS) to set the response operation code11. callback: OBEX_EV_REQCHECK: the first received request package has been par

11、sed;1. callback: OBEX_EV_PROGRESS (the receipt of n events indicates that the customer is correct in transmitting the contents of the file);13. Callback: OBEX EV REQ: OBEX CMD PUT;OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS) sets the response operation code;At this point,Client fi

12、les are transferred and processed:OBEX ObjectGetNextHeader () takes the n ame and con tent of the file separately;Callback: OBEX_EV_REQDONE: OBEX_CMD_PUTCallback: OBEX_EV_REQHINT a request is coming 16. Callback: OBEX_EV_REQ: : OBEX_CMD_DISCONNECTOBEX_ObjectSetRsp (object, OBEX_RSP_SUCCESS, OBEX_RSP

13、_SUCCESS) sets the response operation code;Callback: OBEX_EV_REQDONE: OBEX_CMD_DISCONNECT;OBEX_TransportDisconnect (handle) disconnects;Note: this function simply closes the socket and does not release the resources that the handle occupies, so you need to release the resources that the handle consu

14、mes when applied.OBEX_Cleanup () turns off obex handle and frees the resources that the handie consumes(the function also closes the client and the server-side socket);At this point, the server receives one instance from the clientOBEX is short for Object Exchang, which is IrDA? The protocol for inf

15、rared transmission, but it is not limited to specific underlying transports, can be run on blueteeth, usb, and TCP/IP. OBEX is primarily a session layer protocol, but also includes the application layer It can transmit any object, which is usually used to transfer files, images, business CARDS (Vcar

16、d) and calendar (Veal), etc OpenOBEX is an open source OBEX protocol implementation that provides both client and server functionality This article briefly introduces OBEX and OpenOBEXOBEX protocol stack on top of irDA (infrared protocol):IrLAP is the data link layer protoco1.IrLMP is a multiplexing protoco1.Tiny TP provides f1ow contro1.IAS is Information Access ServiceInfrared proto

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号