bosko lekovic
/
ETHtoCOM_10
nova verzija tcp+udp->serial com
main.cpp
- Committer:
- bosko001
- Date:
- 2020-04-18
- Revision:
- 7:7ea932eb31f6
- Parent:
- 5:c9a908749d4c
- Child:
- 11:2cc7e6f06cff
File content as of revision 7:7ea932eb31f6:
#include "mbed.h" #include "clubbing.h" #include "EthernetSetup.h" #include "UdpToScom.h" #include "TcpServerToFlash.h" #include "dxml.h" #include "doHTML.h" #include "dataFlash.h" #include "string.h" volatile PFV pfv = NULL; DigitalOut GLed(LED2,1); void pfv_fun( void ) { while(true) { if(pfv) {pfv(); pfv = NULL;} cleanTcpServerToFlashThread( ); } } Thread pfv_thread(pfv_fun); void input_fun( void ) { while(true) { unsigned char uc; uc = (unsigned char)getchar( ); printf( "\n\runesen karakter %c\n\r", uc); if( uc == 'h' ) { extern C_HTMLparse *gpc_html; auto c = gpc_html->getHTML_free( ); printf("\n\r%s\n\r", c); free(c); } } } Thread input_thread(input_fun); C_HTMLparse *gpc_html; int main(void) { printf("\n\r---------- POCETAK ------------- \n\r"); init_FlashData( ); showFlashData( ); gpc_html = new C_HTMLparse; // putHTMLintoFLASH( gpc_html ); putFLASHintoHTML( gpc_html ); init_EthToScom( ); inic_TcpServerToFlash( ); extern void test_HTML(void); // test_HTML( ); int i=0; while(true) { if(i++ >10 ) { i=0; GLed = !GLed;} wait(0.01); } deinit_FlashData( ); } // //enum nsapi_error { // NSAPI_ERROR_OK = 0, /*!< no error */ // NSAPI_ERROR_WOULD_BLOCK = -3001, /*!< no data is not available but call is non-blocking */ // NSAPI_ERROR_UNSUPPORTED = -3002, /*!< unsupported functionality */ // NSAPI_ERROR_PARAMETER = -3003, /*!< invalid configuration */ // NSAPI_ERROR_NO_CONNECTION = -3004, /*!< not connected to a network */ // NSAPI_ERROR_NO_SOCKET = -3005, /*!< socket not available for use */ // NSAPI_ERROR_NO_ADDRESS = -3006, /*!< IP address is not known */ // NSAPI_ERROR_NO_MEMORY = -3007, /*!< memory resource not available */ // NSAPI_ERROR_NO_SSID = -3008, /*!< ssid not found */ // NSAPI_ERROR_DNS_FAILURE = -3009, /*!< DNS failed to complete successfully */ // NSAPI_ERROR_DHCP_FAILURE = -3010, /*!< DHCP failed to complete successfully */ // NSAPI_ERROR_AUTH_FAILURE = -3011, /*!< connection to access point failed */ // NSAPI_ERROR_DEVICE_ERROR = -3012, /*!< failure interfacing with the network processor */ // NSAPI_ERROR_IN_PROGRESS = -3013, /*!< operation (eg connect) in progress */ // NSAPI_ERROR_ALREADY = -3014, /*!< operation (eg connect) already in progress */ // NSAPI_ERROR_IS_CONNECTED = -3015, /*!< socket is already connected */ // NSAPI_ERROR_CONNECTION_LOST = -3016, /*!< connection lost */ // NSAPI_ERROR_CONNECTION_TIMEOUT = -3017, /*!< connection timed out */ //};