Statistics
| Revision:

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

History | View | Annotate | Download (1007 Bytes)

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  1024 // Bufer size in bytes
26
   // TODO: buffer size should be bigger!
27

    
28
 int listenTo(unsigned short int portNum);
29
 
30
 #endif