VZTECH / Mbed 2 deprecated main_src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers config_manager.h Source File

config_manager.h

00001 %: ifndef __CONFIG_MANAGER_H__
00002 %: define __CONFIG_MANAGER_H__
00003 
00004 %: include <stdint.h>
00005 %: include <string.h>
00006 %: include "file_system_manager.h"
00007 
00008 /**
00009  * Classe que representa lógicamente os valores das variáveis de 
00010  * ambiente usadas pela Cabeceira, estas variáveis são arquivadas
00011  * em arquivos e carregadas durante o boot.
00012  *
00013  * Header IP 192.168.120.171
00014  * Header ext 820
00015  * Header port 5062
00016  * Server IP 192.168.120.120
00017  * Server ext 723
00018  * Server port 5075
00019  * Mascara de rede 255.255.255.0
00020  * Gateway IP 192.168.120.1
00021  * FW Server IP 192.168.120.120
00022  * FW Server Port 6667
00023  * Max Ext 6000
00024  * Min Ext 5000
00025  * Shift Port 3000
00026  */
00027  
00028 const uint16_t u16_SHIFT_PORT = 3000;
00029 ///< Deslocamento padrão de porta, usado na forma <ext recebido + SHIFT_PORT>
00030 
00031 const char MY_IP[] = "192.168.120.171";
00032 ///< Representa o IP default da Header.
00033 //#define __MY_IP__ "192.168.2.20?" // Colinas
00034 //#define __MY_IP__ "192.168.1.200" // Colinas
00035 
00036 const char SERVER_IP[] =  "192.168.120.120";
00037 ///< Indica o IP defaut do servidor para onde a Header ira encaminhar pedidos de ligação.
00038 //#define __SERVER_IP__ "192.168.30.25" // Colinas
00039 
00040 const uint16_t u16_MIN_EXT = 1;
00041 ///< Define o valor minimo de ramal que sera processado.
00042 
00043 const uint16_t u16_MAX_EXT = 5999;
00044 ///< Define o valor máximo de ramal que sera processado.
00045 
00046 const uint16_t u16_MY_EXT = 820;
00047 ///< Indica o ramal default da Header.
00048 
00049 const uint16_t u16_MY_PORT = 5062;
00050 ///< Representa a porta default da Header.
00051 
00052 const uint16_t u16_PEER_EXT = 913;
00053 ///< Estabelece o ramal default para onde a Header ira direcionar os pedidos de ligações.
00054 //#define __PEER_EXT__ 812 // VZ Producao
00055 //#define __PEER_EXT__ 813 // VZ Desenvolvimento
00056 
00057 const uint16_t u16_SERVER_PORT =  5075;
00058 ///< Indica a porta default do server para onde os pacotes eth serão enviados na negociação SIP.
00059 //#define __SERVER_PORT__ 5060 // Colinas
00060 
00061 const char MY_MSK[] =  "255.255.255.0";
00062 ///< Indica a mascara de rede onde a Header se encontra.
00063 //#define __MY_GTW__ "192.168.2.254" // Colinas
00064 
00065 const char MY_GTW[] = "192.168.120.1";  // vz
00066 ///< Indica o IP do Gateway de rede
00067 
00068 const uint16_t u16_UDP_PORT_LISTENER = 11406;
00069 ///< Porta UDP na qual a Header espera por eventuais mensagens.
00070 
00071 const uint16_t u16_TCP_PORT_LISTENER = 7879;
00072 ///< Porta TCP na qual a Header espera por eventuais mensagens.
00073 
00074 const uint16_t u16_UDP_BOOTLOADER_PORT = 9891;
00075 ///< Porta UDP para tratativas do procedimento de gravação dos CBx.
00076 
00077 const char FW_SERVER_IP[] =  "192.168.120.144";
00078 ///< Estabelece o IP default para onde os dados de telemetria são enviados.
00079 const uint16_t u16_FW_SERVER_PORT = 9192;
00080 ///< Estabelece a porta default do servidor  para onde os dados de telemetria são enviados
00081 
00082 const uint8_t u8_IP_LENGTH = 46;
00083 
00084 const uint8_t u8_ACCEPTABLE_DELAY = 240;
00085 
00086 const uint8_t u8_FIBRA_MODE = 0x46; // ascii F
00087 
00088 const uint8_t u8_RADIO_MODE = 0x52; // ascii R
00089 
00090 const uint8_t u8_CUSTOM_MODE = 0x43; // ascii C
00091 
00092 class ConfigManager
00093 {
00094     private :
00095         char chHeader_ip[ u8_IP_LENGTH ];
00096         uint16_t u16Ext;
00097         uint16_t u16Port;
00098         char chServer_ip[ u8_IP_LENGTH ];
00099         uint16_t u16Server_ext;
00100         uint16_t u16Server_port;
00101         char chNet_mask[ u8_IP_LENGTH ];
00102         char chGateway[ u8_IP_LENGTH ];
00103         char chFw_server_ip[ u8_IP_LENGTH ];
00104         uint16_t u16Fw_server_port;
00105         uint16_t u16Max_ext;
00106         uint16_t u16Min_ext;
00107         uint16_t u16Shift_port;
00108         uint16_t u16Udp_port_listener;
00109         uint16_t u16Tcp_port_listener;
00110         bool boolModified;
00111         bool boolHeader_ip_was_modified;
00112         bool boolServer_ip_was_modified;
00113         bool boolNet_mask_was_modified;
00114         bool boolGateway_was_modified;
00115         bool boolFw_server_ip_was_modified;
00116         bool boolHeader_ext_was_modified;
00117         bool boolHeader_sip_port_was_modified;
00118         bool boolServer_ext_was_modified;
00119         bool boolServer_port_was_modified;
00120         bool boolFw_server_port_was_modified;
00121         bool boolMax_ext_was_modified;
00122         bool boolMin_ext_was_modified;
00123         bool boolShift_port_was_modified;
00124         bool boolCallBoxDetachMode;
00125         bool boolCallBoxWakeMode;
00126         uint8_t u8CallBoxMode;
00127         char chClock_erver_ip [ u8_IP_LENGTH ];
00128         uint8_t u8Acceptable_delay;
00129         
00130         void cbx_custom_mode_check ( void );
00131 
00132     public  :
00133         ConfigManager ( void );
00134         ~ConfigManager ( void );
00135 
00136         char * get_header_ip ( char * buffer );
00137         char * get_server_ip ( char * buffer );
00138         char * get_net_mask ( char * buffer );
00139         char * get_gateway ( char * buffer );
00140         char * get_fw_server_ip ( char * buffer );
00141         char * get_clock_server_ip ( char * buffer );
00142 
00143         uint8_t get_acceptable_delay ( void );
00144         uint16_t get_ext ( void );
00145         uint16_t get_port ( void );
00146         uint16_t get_server_ext ( void );
00147         uint16_t get_server_port ( void );
00148         uint16_t get_fw_server_port ( void );
00149         uint16_t get_max_ext ( void );
00150         uint16_t get_min_ext ( void );
00151         uint16_t get_shift_port ( void );
00152         uint16_t get_udp_port_listener ( void );
00153         uint16_t get_tcp_port_listener ( void );
00154         bool was_modified ( void );
00155         
00156         bool header_ip_was_modified ( void );
00157         bool server_ip_was_modified ( void );
00158         bool net_mask_was_modified ( void );
00159         bool gateway_was_modified ( void );
00160         bool fw_server_ip_was_modified ( void );
00161         bool header_ext_was_modified ( void );
00162         bool header_sip_port_was_modified ( void );
00163         bool server_ext_was_modified ( void );
00164         bool server_port_was_modified ( void );
00165         bool fw_server_port_was_modified ( void );
00166         bool max_ext_was_modified ( void );
00167         bool min_ext_was_modified ( void );
00168         bool shift_port_was_modified ( void );
00169         bool get_cbx_detach_mode ( void );
00170         bool get_cbx_wake_mode ( void );
00171         uint8_t get_cbx_mode ( void );
00172         
00173         void set_header_ip ( const char * new_header_ip );
00174         void set_server_ip ( const char * new_server_ip );
00175         void set_net_mask ( const char * new_net_mask );
00176         void set_gateway ( const char * new_gateway );
00177         void set_fw_server_ip ( const char * new_fw_server_ip );
00178         void set_header_ext ( const uint16_t new_ext );
00179         void set_header_sip_port ( const uint16_t new_port );
00180         void set_server_ext ( const uint16_t new_server_ext );
00181         void set_server_port ( const uint16_t new_server_port );
00182         void set_fw_server_port ( const uint16_t new_fw_server_port );
00183         void set_max_ext ( const uint16_t new_max_ext );
00184         void set_min_ext ( const uint16_t new_min_ext );
00185         void set_shift_port ( const uint16_t new_shift_port );
00186         void set_udp_port_listener ( const uint16_t new_udp_port_listener );
00187         void set_tcp_port_listener ( const uint16_t new_tcp_port_listener );
00188         void set_modified_true ( void );
00189         void set_modified_false ( void );
00190         void set_acceptable_delay ( const uint8_t new_acceptable_delay );
00191         void set_cbx_detach_mode ( const bool new_cbx_detach_mode );
00192         void set_cbx_wake_mode ( const bool new_cbx_wake_mode );
00193         void set_cbx_mode ( const uint8_t new_cbx_mode );
00194         
00195         void restore_defaults_settings ( void );
00196 };
00197 
00198 %: endif