bosko lekovic
/
ETHtoCOM_10
nova verzija tcp+udp->serial com
Diff: doHTML.cpp
- Revision:
- 9:893843262a1f
- Parent:
- 8:c0f54b381346
- Child:
- 12:cbfc10c15437
diff -r c0f54b381346 -r 893843262a1f doHTML.cpp --- a/doHTML.cpp Sun Apr 19 22:13:45 2020 +0000 +++ b/doHTML.cpp Wed Apr 22 13:21:50 2020 +0000 @@ -239,8 +239,29 @@ return NULL; } + + const char * C_HTMLparse::get_BaudRate( void ) + { + return get_selected_option( "baud_rate" ); + } + const char * C_HTMLparse::get_Parity( void ) + { + return get_selected_option( "parity" ); + } + const char * C_HTMLparse::get_StopBits( void ) + { + return get_selected_option( "stop_bits" ); + } + const char * C_HTMLparse::get_DataBits( void ) + { + return get_selected_option( "data_bits" ); + } + + #define COPY_IP_ATTR_VALUE( DXML_T, STR ) { char *s = (char *)dxml_attr( DXML_T, "value"); if( s ) {strcpy( s, STR ); dxml_set_attr( DXML_T, "value", s); } } +//#define COPY_IP_ATTR_VALUE( DXML_T, STR ) { char *s = (char *)dxml_attr( DXML_T, "value"); free( s ); char *d = (char *)malloc( strlen(STR)+1); strcpy( s, STR ); dxml_set_attr( DXML_T, "value", d); } + #define COPY_PORT_ATTR_VALUE( DXML_T, STR ) { char *s = (char *)dxml_attr( DXML_T, "value"); if( s ) {strcpy( s, STR ); dxml_set_attr( DXML_T, "value", s); } } void C_HTMLparse::set_myIP( const char* str ) { if( test_ip( str )) COPY_IP_ATTR_VALUE( front_row[0], str ); } @@ -258,7 +279,7 @@ if( (i > 0) && (i <= 5 ) ) { if( test_ip( str ) ) COPY_IP_ATTR_VALUE( UDPs[i], str ) - else COPY_IP_ATTR_VALUE( UDPs[i], " " ) + else COPY_IP_ATTR_VALUE( UDPs[i], "xxx.xxx.xxx.xxx" ) } } void C_HTMLparse::set_UdpPort( int i, const char* str ) @@ -266,7 +287,7 @@ if( (i>0) && (i<= 4) ) { if (test_num( str ) ) COPY_PORT_ATTR_VALUE( UDPs[i+5], str ) - else COPY_PORT_ATTR_VALUE( UDPs[i+5], " " ) +// else COPY_PORT_ATTR_VALUE( UDPs[i+5], " " ) } } @@ -275,7 +296,7 @@ if( (i > 0) && (i <= 5 ) ) { if( test_ip( str ) ) COPY_IP_ATTR_VALUE( TCPs[i], str ) /////// dxml_set_attr( TCPs[i], "value", str); - else COPY_IP_ATTR_VALUE( TCPs[i], " " ) /////// dxml_set_attr( TCPs[i], "value", str); + else COPY_IP_ATTR_VALUE( TCPs[i], "xxx.xxx.xxx.xxx" ) /////// dxml_set_attr( TCPs[i], "value", str); } } void C_HTMLparse::set_TcpPort( int i, const char* str ) @@ -283,7 +304,7 @@ if( (i>0) && (i<= 4) ) { if( test_num( str ) ) COPY_PORT_ATTR_VALUE( TCPs[i+5], str ) ////dxml_set_attr( TCPs[i+6], "value", str) ; - else COPY_PORT_ATTR_VALUE( TCPs[i+5], " " ) +// else COPY_PORT_ATTR_VALUE( TCPs[i+5], " " ) } } @@ -442,7 +463,7 @@ { for(int i = 0; i<27; i++ ) { - // printf(" rb = %d name:%s = value:%s \n\r", i, s_hpv[i].name, s_hpv[i].value ); + // printf(" rb = %d name:%s = value:%s \n\r", i, s_hpv[i].name, s_hpv[i].value ); if( !strcmp( s_hpv[i].name, "ip_adresa") ) set_myIP( s_hpv[i].value ); else if( !strcmp( s_hpv[i].name, "netmask") ) set_myMASK( s_hpv[i].value );