![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
voltando a versao de n aberturas e fechamentos de sockets data 19/09
Dependencies: EthernetInterface NTPClient mbed-rtos mbed EALib
Fork of header_main_publish by
call_box.h@3:cd9148672e25, 2014-09-10 (annotated)
- Committer:
- klauss
- Date:
- Wed Sep 10 18:21:48 2014 +0000
- Revision:
- 3:cd9148672e25
- Parent:
- 1:a1758104fa1d
- Child:
- 12:07fd716e0f35
versao estavel; - Realiza ligacao de 1 cb, master/slave, como musica de conforto e tratamento sip/rtp, desalocacao de recursos.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
klauss | 0:4d17cd9c8f9d | 1 | #ifndef __CALL_BOX_H__ |
klauss | 0:4d17cd9c8f9d | 2 | #define __CALL_BOX_H__ |
klauss | 0:4d17cd9c8f9d | 3 | |
klauss | 0:4d17cd9c8f9d | 4 | #include "mbed.h" |
klauss | 0:4d17cd9c8f9d | 5 | #include "object.h" |
klauss | 0:4d17cd9c8f9d | 6 | #include "sip.h" |
klauss | 0:4d17cd9c8f9d | 7 | #include "debug.h" |
klauss | 0:4d17cd9c8f9d | 8 | #define __TIMEOUT__ 30 /*seconds*/ |
klauss | 3:cd9148672e25 | 9 | #define __MAX_ATTEMPTS__ 3 |
klauss | 0:4d17cd9c8f9d | 10 | #define __STEP__ 30 /*seconds*/ |
klauss | 0:4d17cd9c8f9d | 11 | #define __MAX_TIMEOUT__ __STEP__ * __MAX_ATTEMPTS__ |
klauss | 0:4d17cd9c8f9d | 12 | |
klauss | 0:4d17cd9c8f9d | 13 | |
klauss | 0:4d17cd9c8f9d | 14 | #define cb_idle 1 |
klauss | 0:4d17cd9c8f9d | 15 | #define cb_ringing 2 |
klauss | 0:4d17cd9c8f9d | 16 | #define cb_trying 3 |
klauss | 0:4d17cd9c8f9d | 17 | #define cb_on_call 4 |
klauss | 0:4d17cd9c8f9d | 18 | #define cb_busy 5 |
klauss | 0:4d17cd9c8f9d | 19 | |
klauss | 0:4d17cd9c8f9d | 20 | class Call_Box : public Object{ |
klauss | 0:4d17cd9c8f9d | 21 | private : |
klauss | 0:4d17cd9c8f9d | 22 | int ext; // ramal |
klauss | 0:4d17cd9c8f9d | 23 | int port; // porta |
klauss | 0:4d17cd9c8f9d | 24 | Timer t; |
klauss | 0:4d17cd9c8f9d | 25 | uint8_t remaining_attempts; |
klauss | 0:4d17cd9c8f9d | 26 | float timeout; |
klauss | 0:4d17cd9c8f9d | 27 | uint8_t msg_id; |
klauss | 0:4d17cd9c8f9d | 28 | uint8_t timeslice; |
klauss | 0:4d17cd9c8f9d | 29 | |
klauss | 0:4d17cd9c8f9d | 30 | public : |
klauss | 0:4d17cd9c8f9d | 31 | Sip * sip; |
klauss | 0:4d17cd9c8f9d | 32 | Call_Box( int ext, int port ); |
klauss | 0:4d17cd9c8f9d | 33 | ~Call_Box( void ); |
klauss | 0:4d17cd9c8f9d | 34 | |
klauss | 0:4d17cd9c8f9d | 35 | uint8_t status; |
klauss | 0:4d17cd9c8f9d | 36 | |
klauss | 0:4d17cd9c8f9d | 37 | int get_ext( void ); |
klauss | 0:4d17cd9c8f9d | 38 | int get_port( void ); |
klauss | 0:4d17cd9c8f9d | 39 | |
klauss | 0:4d17cd9c8f9d | 40 | float get_elapsed_time( void ); |
klauss | 0:4d17cd9c8f9d | 41 | bool is_timeout( void ); |
klauss | 0:4d17cd9c8f9d | 42 | uint8_t reconfigure_timeout( void ); |
klauss | 0:4d17cd9c8f9d | 43 | void reset_elapsed_time( void ); |
klauss | 0:4d17cd9c8f9d | 44 | void registry( void ); |
klauss | 0:4d17cd9c8f9d | 45 | VZ_call * invite( void ); |
klauss | 0:4d17cd9c8f9d | 46 | void set_msg_id( uint8_t msg_id ); |
klauss | 0:4d17cd9c8f9d | 47 | uint8_t get_msg_id( void ); |
klauss | 0:4d17cd9c8f9d | 48 | void set_timeslice( uint8_t timeslice ); |
klauss | 0:4d17cd9c8f9d | 49 | uint8_t get_timeslice( void ); |
klauss | 0:4d17cd9c8f9d | 50 | //void set_sip( Sip * sip ); |
klauss | 0:4d17cd9c8f9d | 51 | int listen_SIP_server( void ); |
klauss | 0:4d17cd9c8f9d | 52 | void unregistry( void ); |
klauss | 0:4d17cd9c8f9d | 53 | void send_bye( void ); |
klauss | 1:a1758104fa1d | 54 | void reset_sip( void ); |
klauss | 0:4d17cd9c8f9d | 55 | }; |
klauss | 0:4d17cd9c8f9d | 56 | |
klauss | 0:4d17cd9c8f9d | 57 | #endif |