![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
dropbox access
Dependencies: EthernetInterface HTTPClient mbed-rtos mbed
Fork of SimpleDropbox by
Revision 2:3b43fb225342, committed 2015-07-22
- Comitter:
- thursday1024
- Date:
- Wed Jul 22 08:30:52 2015 +0000
- Parent:
- 1:93e791b4657f
- Commit message:
- dropbox access
Changed in this revision
dropbox.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 93e791b4657f -r 3b43fb225342 dropbox.cpp --- a/dropbox.cpp Mon Dec 08 12:06:03 2014 +0000 +++ b/dropbox.cpp Wed Jul 22 08:30:52 2015 +0000 @@ -1,24 +1,19 @@ +// dropbox.cpp /* dropbox.c - * * Copyright (C) 2006-2014 wolfSSL Inc. - * * This file is part of CyaSSL. - * * CyaSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * * CyaSSL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - #include "mbed.h" #include "EthernetInterface.h" #include "HTTPClient.h" @@ -52,3 +47,9 @@ } return HTTP_OK ; } + + + + + +
diff -r 93e791b4657f -r 3b43fb225342 main.cpp --- a/main.cpp Mon Dec 08 12:06:03 2014 +0000 +++ b/main.cpp Wed Jul 22 08:30:52 2015 +0000 @@ -1,8 +1,12 @@ +// dropbox_access main.cpp #include "mbed.h" #include "EthernetInterface.h" #include "HTTPClient.h" -#define SHARED_LINK "https://www.dropbox.com/s/m856g2irwzb68uv/test.txt?dl=0" + +//#define SHARED_LINK "https://www.dropbox.com/s/m856g2irwzb68uv/test.txt?dl=0" +#define SHARED_LINK "https://www.dropbox.com/s/gtard2k48f2y8yy/test.txt?dl=0" + extern HTTPResult dropbox_get(const char *url, char *buff, int size) ; @@ -10,28 +14,26 @@ HTTPClient http; char recvBuff[1024*20]; -int main() -{ +int main(){ + HTTPResult ret ; - + eth.init(); //Use DHCP - printf("Dropbox Shared Link, Starting,...\n") ; - + printf( "Dropbox Shared Link, Starting,...\n" ) ; while(1) { if(eth.connect() == 0)break ; printf("Retry\n") ; } - printf("HTTP Client, IP Address is %s\n", eth.getIPAddress()); - + printf("HTTP Client, IP Address is %s\n", eth.getIPAddress() ); printf("Shared Link: %s\n", SHARED_LINK); - memset(recvBuff, '\0', sizeof(recvBuff)) ; - ret = dropbox_get(SHARED_LINK, recvBuff, sizeof(recvBuff)); + + memset( recvBuff, '\0', sizeof(recvBuff) ); + ret = dropbox_get( SHARED_LINK, recvBuff, sizeof(recvBuff) ); if (ret == HTTP_OK) { - printf("Result: %s\n", recvBuff); + printf( "Result: %s\n", recvBuff ); } else { - printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode()); + printf( "Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode() ); } - eth.disconnect(); while(1) {