Statistics
| Revision:

root / logic / trunk / src / hci_comm / hci_comm.h @ 57

History | View | Annotate | Download (1.09 KB)

1
/*
2
 * hci_comm.h
3
 *
4
 * 2011, Aleksander Besir (alex.besir@gmail.com)
5
 *
6
 */
7

    
8
 #ifndef _ENERAPTOR_HCI_COMM
9
 #define _ENERAPTOR_HCI_COMM
10

    
11
 // Error codes
12
 #define HCI_COMM_TERMINATED_BY_LOGIC  0 // Terminated by logic
13
 #define HCI_COMM_ERR_NEW_SOCKET_FAIL -1 // Cannot create new socket
14
 #define HCI_COMM_ERR_BIND_FAIL       -2 // Cannot bind socket to port
15
 #define HCI_COMM_ERR_LISTEN_FAIL     -3 // Cannot listen to port
16
 #define HCI_COMM_ERR_ACCEPT_FAIL     -4 // Cannot accept request
17
 #define HCI_COMM_ERR_READ_FAIL       -5 // Cannot read request
18
 #define HCI_COMM_ERR_WRITE_FAIL      -6 // Cannot write response
19
 #define HCI_COMM_ERR_BUF_ALOC_FAIL  -99 // Cannot alocate memory for buffer
20

    
21
 // Program codes
22
 #define HCI_COMM_TERMINATE           -1 // Terminates the infinite listening loop
23

    
24
 // Constants
25
 #define HCI_COMM_REQUEST_BUFFER_SIZE  1048576 // Bufer size in bytes
26
 #define HCI_COMM_RESPONSE_BUFFER_SIZE  1048576 // Bufer size in bytes
27
 #define HCI_COMM_LINE_BUFFER_SIZE  1048576 // Bufer size in bytes
28
   // TODO: buffer size should be bigger!
29

    
30
 int listenTo(unsigned short int portNum);
31

    
32
 #endif