bosko lekovic
/
ETHtoCOM_10
nova verzija tcp+udp->serial com
main.cpp@5:c9a908749d4c, 2020-04-12 (annotated)
- Committer:
- bosko001
- Date:
- Sun Apr 12 17:59:57 2020 +0000
- Revision:
- 5:c9a908749d4c
- Parent:
- 4:7abcf4543282
- Child:
- 7:7ea932eb31f6
12.04.2020; napravljena class C_HTMLparse; treba napraviti obradu POST upita
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bosko001 | 0:fe8cd064ea08 | 1 | #include "mbed.h" |
bosko001 | 2:45b351b4fc2a | 2 | #include "clubbing.h" |
bosko001 | 2:45b351b4fc2a | 3 | #include "EthernetSetup.h" |
bosko001 | 2:45b351b4fc2a | 4 | #include "UdpToScom.h" |
bosko001 | 2:45b351b4fc2a | 5 | #include "TcpServerToFlash.h" |
bosko001 | 2:45b351b4fc2a | 6 | #include "dxml.h" |
bosko001 | 2:45b351b4fc2a | 7 | #include "doHTML.h" |
bosko001 | 3:1196befeace0 | 8 | #include "dataFlash.h" |
bosko001 | 2:45b351b4fc2a | 9 | #include "string.h" |
bosko001 | 0:fe8cd064ea08 | 10 | |
bosko001 | 5:c9a908749d4c | 11 | |
bosko001 | 5:c9a908749d4c | 12 | |
bosko001 | 5:c9a908749d4c | 13 | |
bosko001 | 5:c9a908749d4c | 14 | |
bosko001 | 2:45b351b4fc2a | 15 | volatile PFV pfv = NULL; |
bosko001 | 1:e1bde4e82763 | 16 | |
bosko001 | 1:e1bde4e82763 | 17 | |
bosko001 | 2:45b351b4fc2a | 18 | DigitalOut GLed(LED2,1); |
bosko001 | 1:e1bde4e82763 | 19 | |
bosko001 | 2:45b351b4fc2a | 20 | void pfv_fun( void ) |
bosko001 | 1:e1bde4e82763 | 21 | { |
bosko001 | 2:45b351b4fc2a | 22 | while(true) |
bosko001 | 2:45b351b4fc2a | 23 | { |
bosko001 | 2:45b351b4fc2a | 24 | if(pfv) {pfv(); pfv = NULL;} |
bosko001 | 2:45b351b4fc2a | 25 | cleanTcpServerToFlashThread( ); |
bosko001 | 2:45b351b4fc2a | 26 | |
bosko001 | 2:45b351b4fc2a | 27 | } |
bosko001 | 1:e1bde4e82763 | 28 | } |
bosko001 | 2:45b351b4fc2a | 29 | Thread pfv_thread(pfv_fun); |
bosko001 | 1:e1bde4e82763 | 30 | |
bosko001 | 5:c9a908749d4c | 31 | C_HTMLparse *gpc_html; |
bosko001 | 0:fe8cd064ea08 | 32 | |
bosko001 | 0:fe8cd064ea08 | 33 | int main(void) |
bosko001 | 0:fe8cd064ea08 | 34 | { |
bosko001 | 1:e1bde4e82763 | 35 | |
bosko001 | 2:45b351b4fc2a | 36 | printf("\n\r---------- POCETAK ------------- \n\r"); |
bosko001 | 3:1196befeace0 | 37 | |
bosko001 | 3:1196befeace0 | 38 | init_FlashData( ); |
bosko001 | 3:1196befeace0 | 39 | showFlashData( ); |
bosko001 | 3:1196befeace0 | 40 | |
bosko001 | 5:c9a908749d4c | 41 | gpc_html = new C_HTMLparse; |
bosko001 | 3:1196befeace0 | 42 | |
bosko001 | 5:c9a908749d4c | 43 | // putHTMLintoFLASH( gpc_html ); |
bosko001 | 5:c9a908749d4c | 44 | putFLASHintoHTML( gpc_html ); |
bosko001 | 3:1196befeace0 | 45 | |
bosko001 | 1:e1bde4e82763 | 46 | |
bosko001 | 2:45b351b4fc2a | 47 | init_EthToScom( ); |
bosko001 | 2:45b351b4fc2a | 48 | inic_TcpServerToFlash( ); |
bosko001 | 1:e1bde4e82763 | 49 | |
bosko001 | 1:e1bde4e82763 | 50 | |
bosko001 | 4:7abcf4543282 | 51 | extern void test_HTML(void); |
bosko001 | 5:c9a908749d4c | 52 | // test_HTML( ); |
bosko001 | 4:7abcf4543282 | 53 | |
bosko001 | 2:45b351b4fc2a | 54 | |
bosko001 | 2:45b351b4fc2a | 55 | int i=0; |
bosko001 | 2:45b351b4fc2a | 56 | while(true) |
bosko001 | 2:45b351b4fc2a | 57 | { |
bosko001 | 2:45b351b4fc2a | 58 | if(i++ >10 ) { i=0; GLed = !GLed;} |
bosko001 | 2:45b351b4fc2a | 59 | wait(0.01); |
bosko001 | 0:fe8cd064ea08 | 60 | } |
bosko001 | 3:1196befeace0 | 61 | |
bosko001 | 3:1196befeace0 | 62 | deinit_FlashData( ); |
bosko001 | 3:1196befeace0 | 63 | |
bosko001 | 3:1196befeace0 | 64 | |
bosko001 | 0:fe8cd064ea08 | 65 | } |
bosko001 | 0:fe8cd064ea08 | 66 | |
bosko001 | 1:e1bde4e82763 | 67 | |
bosko001 | 2:45b351b4fc2a | 68 | |
bosko001 | 2:45b351b4fc2a | 69 | |
bosko001 | 2:45b351b4fc2a | 70 | |
bosko001 | 1:e1bde4e82763 | 71 | |
bosko001 | 1:e1bde4e82763 | 72 | |
bosko001 | 1:e1bde4e82763 | 73 | |
bosko001 | 0:fe8cd064ea08 | 74 | // |
bosko001 | 0:fe8cd064ea08 | 75 | //enum nsapi_error { |
bosko001 | 0:fe8cd064ea08 | 76 | // NSAPI_ERROR_OK = 0, /*!< no error */ |
bosko001 | 0:fe8cd064ea08 | 77 | // NSAPI_ERROR_WOULD_BLOCK = -3001, /*!< no data is not available but call is non-blocking */ |
bosko001 | 0:fe8cd064ea08 | 78 | // NSAPI_ERROR_UNSUPPORTED = -3002, /*!< unsupported functionality */ |
bosko001 | 0:fe8cd064ea08 | 79 | // NSAPI_ERROR_PARAMETER = -3003, /*!< invalid configuration */ |
bosko001 | 0:fe8cd064ea08 | 80 | // NSAPI_ERROR_NO_CONNECTION = -3004, /*!< not connected to a network */ |
bosko001 | 0:fe8cd064ea08 | 81 | // NSAPI_ERROR_NO_SOCKET = -3005, /*!< socket not available for use */ |
bosko001 | 0:fe8cd064ea08 | 82 | // NSAPI_ERROR_NO_ADDRESS = -3006, /*!< IP address is not known */ |
bosko001 | 0:fe8cd064ea08 | 83 | // NSAPI_ERROR_NO_MEMORY = -3007, /*!< memory resource not available */ |
bosko001 | 0:fe8cd064ea08 | 84 | // NSAPI_ERROR_NO_SSID = -3008, /*!< ssid not found */ |
bosko001 | 0:fe8cd064ea08 | 85 | // NSAPI_ERROR_DNS_FAILURE = -3009, /*!< DNS failed to complete successfully */ |
bosko001 | 0:fe8cd064ea08 | 86 | // NSAPI_ERROR_DHCP_FAILURE = -3010, /*!< DHCP failed to complete successfully */ |
bosko001 | 0:fe8cd064ea08 | 87 | // NSAPI_ERROR_AUTH_FAILURE = -3011, /*!< connection to access point failed */ |
bosko001 | 0:fe8cd064ea08 | 88 | // NSAPI_ERROR_DEVICE_ERROR = -3012, /*!< failure interfacing with the network processor */ |
bosko001 | 0:fe8cd064ea08 | 89 | // NSAPI_ERROR_IN_PROGRESS = -3013, /*!< operation (eg connect) in progress */ |
bosko001 | 0:fe8cd064ea08 | 90 | // NSAPI_ERROR_ALREADY = -3014, /*!< operation (eg connect) already in progress */ |
bosko001 | 0:fe8cd064ea08 | 91 | // NSAPI_ERROR_IS_CONNECTED = -3015, /*!< socket is already connected */ |
bosko001 | 0:fe8cd064ea08 | 92 | // NSAPI_ERROR_CONNECTION_LOST = -3016, /*!< connection lost */ |
bosko001 | 0:fe8cd064ea08 | 93 | // NSAPI_ERROR_CONNECTION_TIMEOUT = -3017, /*!< connection timed out */ |
bosko001 | 0:fe8cd064ea08 | 94 | //}; |