Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface HTTPClient SDFileSystem mbed-rtos mbed wolfSSL
Fork of SimpleDropbox by
main.cpp
00001 #include "mbed.h" 00002 #include "EthernetInterface.h" 00003 #include "HTTPClient.h" 00004 00005 #include <SDFileSystem.h> 00006 SDFileSystem sdCard(PTE3, PTE1, PTE2, PTE4, "sd"); 00007 00008 extern HTTPResult dropbox_get(const char *url, char *buff, int size) ; 00009 00010 EthernetInterface eth; 00011 HTTPClient http; 00012 char recvBuff[1024*20]; 00013 00014 int main() 00015 { 00016 HTTPResult ret ; 00017 FILE *fp ; 00018 char sharedLink[256] ; 00019 00020 eth.init(); //Use DHCP 00021 printf("Dropbox Shared Link, Starting,...\n") ; 00022 00023 while(1) { 00024 if(eth.connect() == 0)break ; 00025 printf("Retry\n") ; 00026 } 00027 00028 fp = fopen("/sd/sharedLink.txt", "r"); 00029 if (fp == NULL) { 00030 printf("Cannot open \"sharedLink.txt\"\n") ; 00031 return false ; 00032 } 00033 fgets(sharedLink, sizeof(sharedLink), fp) ; 00034 printf("Shared Link: %s\n", sharedLink); 00035 memset(recvBuff, '\0', sizeof(recvBuff)) ; 00036 ret = dropbox_get(sharedLink, recvBuff, sizeof(recvBuff)); 00037 if (ret == HTTP_OK) { 00038 printf("Result: %s\n", recvBuff); 00039 } else { 00040 printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); 00041 } 00042 00043 eth.disconnect(); 00044 00045 while(1) { 00046 } 00047 }
Generated on Thu Aug 4 2022 10:29:59 by
1.7.2
