forked from MoSync/MoSync
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/ThreeOneOne' into ThreeOneOne
- Loading branch information
Showing
13 changed files
with
308 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<?fileVersion 4.0.0?> | ||
|
||
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> | ||
<storageModule moduleId="org.eclipse.cdt.core.settings"> | ||
<cconfiguration id="org.eclipse.cdt.core.default.config.299418359"> | ||
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.299418359" moduleId="org.eclipse.cdt.core.settings" name="Configuration"> | ||
<externalSettings/> | ||
<extensions/> | ||
</storageModule> | ||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | ||
</cconfiguration> | ||
</storageModule> | ||
<storageModule moduleId="org.eclipse.cdt.core.pathentry"> | ||
<pathentry kind="con" path="com.mobilesorcery.mosync.includepaths"/> | ||
</storageModule> | ||
</cproject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project supports-build-configs="true" version="1.4"> | ||
<build.cfg id="Debug" types="Debug"/> | ||
<build.cfg id="Release" types="Release"/> | ||
<criteria> | ||
<filter type="com.mobilesorcery.sdk.capabilities.devices.elementfactory"> | ||
<capabilities optional="" required=""/> | ||
</filter> | ||
</criteria> | ||
<properties> | ||
<property key="build.prefs:additional.libraries" value="MAUtil.lib"/> | ||
<property key="build.prefs:additional.libraries/Debug" value="MAUtilD.lib"/> | ||
<property key="profile.mgr.type" value="0"/> | ||
<property key="template.id" value="project.moblet"/> | ||
</properties> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>ParallelDownloader</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>com.mobilesorcery.sdk.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>com.mobilesorcery.sdk.core.nature</nature> | ||
<nature>org.eclipse.cdt.core.cnature</nature> | ||
<nature>org.eclipse.cdt.core.ccnature</nature> | ||
</natures> | ||
<filteredResources> | ||
<filter> | ||
<id>0</id> | ||
<name></name> | ||
<type>6</type> | ||
<matcher> | ||
<id>org.eclipse.ui.ide.multiFilter</id> | ||
<arguments>1.0-name-matches-false-true-.*rebuild.build.cpp</arguments> | ||
</matcher> | ||
</filter> | ||
</filteredResources> | ||
</projectDescription> |
3 changes: 3 additions & 0 deletions
3
testPrograms/ParallelDownloader/.settings/org.eclipse.core.resources.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#Wed Aug 15 15:13:56 CEST 2012 | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#include <ma.h> | ||
#include <MAUtil/String.h> | ||
#include <MAUtil/Moblet.h> | ||
#include <conprint.h> | ||
#include <maapi.h> | ||
|
||
using namespace MAUtil; | ||
|
||
#include "webImageDownloader.h" | ||
/* | ||
* 8 is the limit of consecutive downloads for Symbian, | ||
* other platforms can do better. | ||
* 32 is the limit on iOS. | ||
*/ | ||
#define NUM_DOWNLOADS 8 | ||
#define NUM_BATCHES 10 | ||
|
||
/** | ||
* Moblet for the application. | ||
*/ | ||
class myMoblet : public Moblet, public webImageDownloaderListener { | ||
public: | ||
myMoblet() | ||
{ | ||
mBatchNumber = 0; | ||
|
||
printf("Number of parallel downloads:%d, number of batches:%d", NUM_DOWNLOADS, NUM_BATCHES); | ||
startDownloads(); | ||
|
||
|
||
} | ||
|
||
void startDownloads() | ||
{ | ||
mFinishedDownloaders = 0; | ||
MAUtil::String url = "http://www.mosync.com/miles/Web%20Scottish%20Loch.jpg"; | ||
mBatchNumber++; | ||
printf("STARTING DOWNLOAD BATCH %d", mBatchNumber); | ||
for(int i = 0; i < NUM_DOWNLOADS; i++) | ||
{ | ||
webImageDownloader * imagedownload = new webImageDownloader(url, "newdataname1", this); | ||
} | ||
} | ||
|
||
void downloadFinished(webImageDownloader *downloader) | ||
{ | ||
delete downloader; | ||
mFinishedDownloaders++; | ||
|
||
if(mFinishedDownloaders == NUM_DOWNLOADS) | ||
{ | ||
if(mBatchNumber < NUM_BATCHES) | ||
{ | ||
startDownloads(); | ||
} | ||
else | ||
{ | ||
printf("TEST PASSED"); | ||
} | ||
} | ||
} | ||
|
||
void myMoblet::init() {} | ||
void myMoblet::draw() {} | ||
|
||
/** | ||
* Destructor. | ||
*/ | ||
virtual ~myMoblet(){} | ||
|
||
private: | ||
int mFinishedDownloaders; | ||
int mBatchNumber; | ||
}; | ||
|
||
extern "C" int MAMain() | ||
{ | ||
InitConsole(); | ||
gConsoleLogging = 1; | ||
|
||
// Run the moblet event loop. | ||
//Moblet::run(moblet); | ||
Moblet::run(new myMoblet()); | ||
|
||
// Deallocate objects. | ||
//delete Moblet; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "webImageDownloader.h" | ||
|
||
webImageDownloader::webImageDownloader(MAUtil::String data, MAUtil::String dataId, webImageDownloaderListener *listener){ | ||
imageDownloader = new Downloader(); | ||
imageDownloader->addDownloadListener(this); | ||
mWebListener = listener; | ||
mImageResource = maCreatePlaceholder(); | ||
printf("Placeholder:%d",mImageResource); | ||
imageDownloader->beginDownloading(data.c_str(), mImageResource); | ||
} | ||
|
||
webImageDownloader::~webImageDownloader(){} | ||
|
||
void webImageDownloader::finishedDownloading(Downloader *dl, MAHandle data){ | ||
printf("finished downloading"); | ||
|
||
if(dl == imageDownloader) { | ||
printf("beginning"); | ||
|
||
printf("datasize = %d", maGetDataSize(data)); | ||
printf("MImage:%d data:%d", mImageResource, data); | ||
MAHandle mystore = maOpenStore("teststore.jpg", MAS_CREATE_IF_NECESSARY); | ||
if(mystore != STERR_NONEXISTENT) { | ||
MAHandle myData = maCreatePlaceholder(); | ||
//if(maCreateData(myData, maGetDataSize(data)) == RES_OK) { | ||
// maWriteData(myData, text.c_str(), 0, maGetDataSize(data)); | ||
//} | ||
int result = maWriteStore(mystore, data); | ||
maCloseStore(mystore, 0); | ||
maDestroyPlaceholder(myData); | ||
} | ||
maDestroyPlaceholder(mImageResource); | ||
mWebListener->downloadFinished(this); | ||
printf("end of downloader"); | ||
} | ||
} | ||
|
||
void webImageDownloader::error(Downloader* dl, int code) { } | ||
//maAlert("error", "", "ok", 0, 0);} | ||
void webImageDownloader::downloadCancelled(Downloader* dl) {} | ||
void webImageDownloader::notifyProgress(Downloader *dl, int downloadedBytes, int totalBytes){} |
Oops, something went wrong.