source: source/ariba/utility/transport/rfcomm/rfcomm.hpp@ 7497

Last change on this file since 7497 was 7464, checked in by Christoph Mayer, 15 years ago

-config include gefixt

File size: 1.9 KB
RevLine 
[7464]1#include "ariba/config.h"
[7041]2
3#ifdef HAVE_LIBBLUETOOTH
4
[5284]5#ifndef RFCOMM_HPP_
6#define RFCOMM_HPP_
7
[5993]8#include "ariba/utility/transport/transport.hpp"
9#include "ariba/utility/transport/asio/asio_io_service.h"
10#include "ariba/utility/transport/asio/bluetooth_endpoint.hpp"
11#include "ariba/utility/transport/asio/rfcomm.hpp"
[5284]12
13#include <boost/thread.hpp>
14#include <boost/system/system_error.hpp>
15#include <boost/asio/io_service.hpp>
16
[5406]17#include "ariba/utility/logging/Logging.h"
18
[5284]19namespace ariba {
20namespace transport {
21
22using boost::system::error_code;
23using namespace boost::asio;
24
25class link_info;
[5406]26class link_data;
[5284]27
28/**
29 * TODO: Doc
30 *
31 * @author Sebastian Mies <mies@tm.uka.de>
32 */
33class rfcomm : public transport_protocol {
[5406]34 use_logging_h(rfcomm)
[5284]35public:
36 rfcomm( uint16_t channel );
37 virtual ~rfcomm();
38 virtual void start();
39 virtual void stop();
40 virtual void send( const address_v* remote, const uint8_t* data, size_t size );
41 virtual void send( const endpoint_set& endpoints, const uint8_t* data, size_t size );
[5614]42 virtual void terminate( const address_v* remote );
[5284]43 virtual void register_listener( transport_listener* listener );
44
45private:
46 uint16_t channel;
47 boost::mutex links_mutex;
48 vector<link_info*> links;
49 io_service& io;
50 transport_listener* listener;
51 bluetooth::rfcomm::acceptor* acceptor;
[5406]52 int accept_retries;
53 link_data* send_data;
[5284]54
55 void start_accept();
56
57 void handle_accept( const error_code& error, link_info* info );
58
59 void start_read( link_info* info );
60
61 void handle_read_header( const error_code& error, size_t bytes, link_info* info );
62
63 void handle_read_data( const error_code& error, size_t bytes, link_info* info );
64
65 void handle_connect( const error_code& error, link_info* info );
66
67 void start_write( link_info* info );
68
69 void handle_write_data(const error_code& error, size_t bytes,
70 link_info* info, size_t size, uint8_t* buffer );
[5289]71
[5406]72 void shutdown(link_info* info);
[5284]73};
74
75}} // namespace ariba::transport
76
77#endif /* RFCOMM_HPP_ */
[7041]78#endif
Note: See TracBrowser for help on using the repository browser.