Beispiel #1
0
extern "C" int MAMain() {
	int res;

	InitConsole();

	printf("CreateData\n");
	maCreateData(RES, 386);
	printf("DestroyObject\n");
	maDestroyObject(RES);

	printf("HTTP GET\n");
	//res = myHttpGetToObject(1, "http://dev.mopix.se:8080/testing/mobile.php");
	{
		MAUtil::HttpGetToObject http("http://link.astando.se/astwms/Request.aspx?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&LAYERS=TO_Vattenytor,TO_Oppen_mark,TO_Byggnadsytor,TO_Vagkonturer,Vagkanter,TO_Geografiska_texter,TO_Allm_byggnadsnamn,Gatunamn&STYLES=&FORMAT=png&BGCOLOR=0xFF0000&TRANSPARENT=TRUE&SRS=EPSG:3152&BBOX=78202.0228224145,99374.2252203757,79546.909389597,100413.827113304&WIDTH=240&HEIGHT=188&reaspect=false", RES);
		res = http.state();
		while(res == 0) {
			EVENT event;
			maWait(0);
			while(maGetEvent(&event)) {
				if(event.type == EVENT_TYPE_CLOSE ||
					(event.type == EVENT_TYPE_KEY_PRESSED && event.key == MAK_0))
				{
					maExit(0);
				} else if(event.type == EVENT_TYPE_CONN) {
					printf("cE %i %i %i\n", event.conn.handle, event.conn.opType, event.conn.result);
					http.notify(event.conn);
					res = http.state();
				}
			}
		}
	}
	printf("Got %i\n", res);
	FREEZE;
}
void CompareScreen::keyPressEvent(int keyCode) {
	switch (keyCode) {
		case MAK_UP:
		case MAK_DOWN:
		case MAK_FIRE:
			Util::updateSoftKeyLayout("", "Back", "Flip", mainLayout);
			imge->refreshWidget();
			imge->statAdded = false;
			currentSelectedStat = -1;

			flip=!flip;
			if (imge->getResource() != NULL) {
				maDestroyObject(imge->getResource());
			}
			if (cmpge->getResource() != NULL) {
				maDestroyObject(cmpge->getResource());
			}
			imge->setResource(Util::loadImageFromResource(RES_LOADING_FLIP1));
			imge->update();
			imge->requestRepaint();

			cmpge->setResource(Util::loadImageFromResource(RES_LOADING_FLIP1));
			cmpge->update();
			cmpge->requestRepaint();

			maUpdateScreen();
			if (flip) {
				Util::retrieveBackFlip(imge, card, height-PADDING*2, imageCache);
				Util::retrieveBackFlip(cmpge, compare, height-PADDING*2, imageCache);
			} else {
				Util::retrieveFrontFlip(imge, card, height-PADDING*2, imageCache);
				Util::retrieveFrontFlip(cmpge, compare, height-PADDING*2, imageCache);
			}
			currentSelectedStat = -1;
			break;
		case MAK_RIGHT:
			break;
		case MAK_LEFT:
			break;
		case MAK_SOFTLEFT:
			break;
		case MAK_BACK:
		case MAK_SOFTRIGHT:
			previous->show();
			break;
	}
}
Beispiel #3
0
/**
 * This method is called when MAW_EVENT_WEB_VIEW_HOOK_INVOKED is received.
 * @param hookType The type of hook that has been invoked.
 * One of:
 *  -#MAW_CONSTANT_SOFT
 *  -#MAW_CONSTANT_HARD
 *
 *  @param urlData The handle to url data. This is string data,
 * there is NO null terminating character. The encoding
 * of the data is determined by the application.
 * The data MUST be deallocated with maDestroyObject after
 * it hs been used. Each event allocates a new data object
 * for the url data.
 */
void MainScreen::webViewHookInvoked(
	WebView* webView,
	int hookType,
	MAHandle urlData)
{
	MAUtil::String type =(hookType == MAW_CONSTANT_SOFT ? "Soft" : "Hard");
	mHookReceived->setText("Hook invoked event received with Hook type: "+ type );

	maDestroyObject(urlData);
}
Beispiel #4
0
void Database::write(MAHandle h) const {
	maDestroyObject(h);
	maCreateData(h, calculateDatabaseSize());
	DataHandler data(h);

	int nDevices = devices.size();
	data.write(&nDevices, sizeof(int));
	for(int i=0; i<nDevices; i++) {
		writeDevice(data, devices[i]);
	}
}
Beispiel #5
0
static MA_FILE* openReadWrite(const char *filename, int modeFlags) {
	MA_FILE *file;
	char sfilename[1024];
	MAHandle store;
	MAHandle data=0;
	int size = BUFFER_SIZE;
	int realLength = 0;

	filterStoreName(sfilename, 1024, filename);
	store = maOpenStore(sfilename, MAS_CREATE_IF_NECESSARY);
	if(!store) return NULL;

	file = (MA_FILE*) malloc(sizeof(MA_FILE));
	if(modeFlags&(MODE_READ|MODE_WRITE)) 
		file->type = TYPE_READWRITE;
	else 
		file->type = TYPE_WRITEONLY;
	file->modeFlags = modeFlags;
	
	if(modeFlags&(MODE_READ|MODE_APPEND)) {
		data = maCreatePlaceholder();
		maReadStore(store, data);
		realLength = size = maGetDataSize(data);
	}

	file->buffer = (unsigned char*) malloc(size);
	if(!file->buffer) {
		free(file->buffer);
		free(file);
		return NULL;
	}

	file->bufferStart = 0;
	file->bufferSize = size;
	file->volEntry = (VolumeEntry*) malloc(sizeof(VolumeEntry));
	file->filePtr = 0;
	file->volEntry->dataOffset = 0;
	file->volEntry->dataLength = realLength;
	file->resultFlags = 0;

	if(modeFlags&(MODE_READ|MODE_APPEND)) {
		maReadData(data, file->buffer, 0, size);
		maDestroyObject(data);
		if(modeFlags&MODE_APPEND) {
			file->filePtr = size;
		}
	}

	file->store = store;
	file->volEntry->type=VOL_TYPE_FILE;

	return file;
}
Beispiel #6
0
	//TestCase
	virtual void start() {
		printf("Testing stores.\n");
		//open, cin
		MAHandle store = maOpenStore("test.store", MAS_CREATE_IF_NECESSARY);
		TI(store);

		//write
		TI(maWriteStore(store, CLIENT_DATA));

		//close
		maCloseStore(store, 0);

		//open
		store = maOpenStore("test.store", 0);
		TI(store);

		//read
		MAHandle data = maCreatePlaceholder();
		maReadStore(store, data);

		//compare
		char storeBuf[DATA_SIZE], clientBuf[DATA_SIZE];
		maReadData(data, storeBuf, 0, DATA_SIZE);
		maReadData(CLIENT_DATA, clientBuf, 0, DATA_SIZE);
		if(memcmp(storeBuf, clientBuf, DATA_SIZE) != 0) {
			assert(name, false);
			suite->runNextCase();
			return;
		}

		//close, delete
		maCloseStore(store, true);
		maDestroyObject(data);

		//open, should fail
		store = maOpenStore("test.store", 0);
		if(store >= 0) {
			maCloseStore(store, true);
			assert(name, false);
			suite->runNextCase();
			return;
		}

		printf("Store test succeded!\n");

		//succeed
		assert(name, true);
		suite->runNextCase();
	}
CompareScreen::~CompareScreen() {
	lprintfln("~CompareScreen::Memory Heap %d, Free Heap %d", heapTotalMemory(), heapFreeMemory());
	if (imge->getResource() != NULL) {
		maDestroyObject(imge->getResource());
	}
	clearListBox();
	listBox->clear();
	delete mainLayout;
	mainLayout = NULL;
	img = -1;
	if (next != NULL) {
		delete next;
		feed->remHttp();
		next = NULL;
	}
	if (imageCache != NULL) {
		delete imageCache;
		imageCache = NULL;
	}
}
void ImageCache::process(bool afterFin)
{
	//Check to see if the cache can process this request at this time
	if(mIsBusy) return;
	//Check to see if there are any outstanding requests
	if(mRequests.size() == 0)
	return;
	//Set the mIsBusy flag, so we don't try to do too much at once
	mIsBusy = true;
	//Get the next image request from the queue

    mNextRequest = mRequests[0];
    if(mHttp.isOpen()){
    	mHttp.close();
    }

    if (mNextRequest->getType() == 5) {
		MAHandle store = maOpenStore((FILE_PREFIX+mNextRequest->getSaveName()).c_str(), 0);
		if(store != STERR_NONEXISTENT) {
			MAHandle cacheimage = maCreatePlaceholder();
			maReadStore(store, cacheimage);
			maCloseStore(store, 0);

			if (maGetDataSize(cacheimage) > 0) {
				Util::returnImage(mNextRequest->getImage(), cacheimage, 64);
			}
			maDestroyObject(cacheimage);
			cacheimage = -1;
		}
		store = -1;
		finishedDownloading();
    } else {
		mHttp = HttpConnection(this);
		int res = mHttp.create(mNextRequest->getUrl().c_str(), HTTP_GET);
		if(res < 0) {
			finishedDownloading();
		} else {
			mHttp.finish();
		}
    }
}
void ImageCache::finishedDownloading()
{
	if (mData != NULL) {
		//Save to storage
		if (mNextRequest != NULL) {
			saveFile((mNextRequest->getSaveName()).c_str(), mData);
			returnImage(mNextRequest->getImage(), mData, mNextRequest->getHeight());
		}
		maDestroyObject(mData);
		mData = NULL;
	}
	else if (mNextRequest != NULL){
		if (mNextRequest->getImage()->getHeight() < 150) {
			mNextRequest->getImage()->setResource(RES_TEMPTHUMB);
		}
		else {
			mNextRequest->getImage()->setResource(RES_TEMP);
		}
		//mNextRequest->getImage()->update();
		mNextRequest->getImage()->requestRepaint();
	}
	else {
		mIsBusy = false;
		if (mRequests.size() > 0)
			process(true);
		return;
	}

	if (mNextRequest != NULL) {
		delete mNextRequest;
		mNextRequest = NULL;
	}
	if (mRequests.size() > 0) {
		mRequests.remove(0);
	}
	mIsBusy = false;
	process(true);
}
void ImageScreen::keyPressEvent(int keyCode) {
	if (strcmp(Card::ORIENTATION_LANDSCAPE, card->getOrientation().c_str()) == 0) {
		//if it is a landscape card, the orientation must be switched
		switch(keyCode) {
			case MAK_UP:
			case MAK_DOWN:
				keyCode = MAK_LEFT;
				break;
			case MAK_LEFT:
				keyCode = MAK_DOWN;
				break;
			case MAK_RIGHT:
				keyCode = MAK_UP;
				break;
		}
	}

	switch (keyCode) {
		case MAK_LEFT:
		case MAK_RIGHT:
			imge->refreshWidget();
			imge->statAdded = false;
			currentSelectedStat = -1;

			flip=!flip;
			if (imge->getResource() != NULL) {
				maDestroyObject(imge->getResource());
			}
			imge->setResource(Util::loadImageFromResource(RES_LOADING1));
			imge->update();
			imge->requestRepaint();
			maUpdateScreen();
			if (flip) {
				Util::retrieveBack(imge, card, height-PADDING*2, imageCacheBack);
				Util::retrieveFront(NULL, card, height-PADDING*2, imageCacheFront);
			} else {
				Util::retrieveFront(imge, card, height-PADDING*2, imageCacheFront);
				Util::retrieveBack(NULL, card, height-PADDING*2, imageCacheBack);
			}
			currentSelectedStat = -1;
			break;
		case MAK_UP:
			if (imge->getResource() != RES_TEMP) {
				if(card->getStats().size()>0){
					selectStat(-1);
					if (currentSelectedStat == -1) {
						if (screenType == ST_NEW_CARD) {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Accept":"", "Reject", "Flip", layout);
						} else if (screenType == Util::AT_SHARE) {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Share":"", "Back", "Flip", layout);
						} else {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Options":"", "Back", "Flip", layout);
						}
						imge->refreshWidget();
						imge->statAdded = false;
					} else {
						if (screenType == ST_NEW_CARD) {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Accept":"", "Reject", "Flip", layout);
						} else if (screenType == Util::AT_SHARE) {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Share":"", "Back", "Flip", layout);
						} else {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Options":"", "Back", "Flip", layout);
						}
						imge->refreshWidget();
						if(flip==card->getStats()[currentSelectedStat]->getFrontOrBack()){
							imge->selectStat(card->getStats()[currentSelectedStat]->getLeft(),card->getStats()[currentSelectedStat]->getTop(),
									card->getStats()[currentSelectedStat]->getWidth(),card->getStats()[currentSelectedStat]->getHeight(),
									card->getStats()[currentSelectedStat]->getColorRed(), card->getStats()[currentSelectedStat]->getColorGreen(),
									card->getStats()[currentSelectedStat]->getColorBlue(), MobImage::PORTRAIT);
						}
					}
				}
			}
			break;
		case MAK_DOWN:
			if (imge->getResource() != RES_TEMP) {
				if(card->getStats().size()>0){
					selectStat(1);
					if (currentSelectedStat == -1) {
						if (screenType == ST_NEW_CARD) {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Accept":"", "Reject", "Flip", layout);
						} else if (screenType == Util::AT_SHARE) {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Share":"", "Back", "Flip", layout);
						} else {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Options":"", "Back", "Flip", layout);
						}
						imge->refreshWidget();
						imge->statAdded = false;
					} else {
						if (screenType == ST_NEW_CARD) {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Accept":"", "Reject", "Flip", layout);
						} else if (screenType == Util::AT_SHARE) {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Share":"", "Back", "Flip", layout);
						} else {
							Util::updateSoftKeyLayout((hasConnection&&canAuction)?"Options":"", "Back", "Flip", layout);
						}
						imge->refreshWidget();
						if(flip==card->getStats()[currentSelectedStat]->getFrontOrBack()){
							imge->selectStat(card->getStats()[currentSelectedStat]->getLeft(),card->getStats()[currentSelectedStat]->getTop(),
									card->getStats()[currentSelectedStat]->getWidth(),card->getStats()[currentSelectedStat]->getHeight(),
									card->getStats()[currentSelectedStat]->getColorRed(), card->getStats()[currentSelectedStat]->getColorGreen(),
									card->getStats()[currentSelectedStat]->getColorBlue(), MobImage::PORTRAIT);
						} else {
							while((flip!=card->getStats()[currentSelectedStat]->getFrontOrBack())&&(currentSelectedStat <= card->getStats().size())){
								selectStat(1);
							}
							imge->selectStat(card->getStats()[currentSelectedStat]->getLeft(),card->getStats()[currentSelectedStat]->getTop(),
																card->getStats()[currentSelectedStat]->getWidth(),card->getStats()[currentSelectedStat]->getHeight(),
																card->getStats()[currentSelectedStat]->getColorRed(), card->getStats()[currentSelectedStat]->getColorGreen(),
																card->getStats()[currentSelectedStat]->getColorBlue(), MobImage::PORTRAIT);
						}
					}
				}
			}
			break;
		case MAK_SOFTLEFT:
			if (screenType == ST_NEW_CARD) {
				busy = true;
				acceptCard();
			} else if (screenType == Util::AT_SHARE) {
				if (next != NULL) {
					feed->remHttp();
					delete next;
				}
				next = new TradeFriendDetailScreen(this, feed, card);
				next->show();
			} else if (screenType == ST_VIEW_CARD) {

			} else {
				if (card != NULL && hasConnection && canAuction) {
					if (next != NULL) {
						feed->remHttp();
						delete next;
					}
					next = new OptionsScreen(feed,
							OptionsScreen::ST_CARD_OPTIONS, this, card);
					next->show();
				}
			}
			break;
		case MAK_BACK:
		case MAK_SOFTRIGHT:
			if (screenType == ST_NEW_CARD) {
				busy = true;
				rejectCard();
			}
			else {
				previous->show();
			}
			break;
		case MAK_FIRE:
			if (card != NULL) {
				if(((flipOrSelect && tapped)&&(currentSelectedStat == -1)) ||
						(!tapped && currentSelectedStat == -1)){
					flip=!flip;
					imge->refreshWidget();
					imge->statAdded = false;
					currentSelectedStat = -1;
					if (imge->getResource() != NULL) {
						maDestroyObject(imge->getResource());
					}
					imge->setResource(Util::loadImageFromResource(RES_LOADING1));
					imge->update();
					imge->requestRepaint();
					maUpdateScreen();
					if (flip) {
						if ((imageCacheBack != NULL)&&(imge != NULL)) {
							Util::retrieveBack(imge, card, height-PADDING*2, imageCacheBack);
							Util::retrieveFront(NULL, card, height-PADDING*2, imageCacheFront);
						}
					} else {
						if ((imageCacheFront != NULL)&&(imge != NULL)) {
							Util::retrieveFront(imge, card, height-PADDING*2, imageCacheFront);
							Util::retrieveBack(NULL, card, height-PADDING*2, imageCacheBack);
						}
					}
					flipOrSelect=0;
					currentSelectedStat = -1;
					tapped = false;
				}else{
					if (imge->getResource() != RES_TEMP) {
						if(currentSelectedStat>-1){
							if(flip==card->getStats()[currentSelectedStat]->getFrontOrBack()){
								imge->refreshWidget();
								imge->selectStat(card->getStats()[currentSelectedStat]->getLeft(),card->getStats()[currentSelectedStat]->getTop(),
										card->getStats()[currentSelectedStat]->getWidth(),card->getStats()[currentSelectedStat]->getHeight(),
										card->getStats()[currentSelectedStat]->getColorRed(), card->getStats()[currentSelectedStat]->getColorGreen(),
										card->getStats()[currentSelectedStat]->getColorBlue(), MobImage::PORTRAIT);
								Stat *stat = card->getStats()[currentSelectedStat];
								if ((strcmp(stat->getDesc().c_str(), "Mobile No") == 0)||
									(strcmp(stat->getDesc().c_str(), "Tel No") == 0) ){
									if (next != NULL) {
										feed->remHttp();
										delete next;
										next == NULL;
									}
									next = new OptionsScreen(feed, OptionsScreen::ST_NUMBER_OPTIONS, this, card, stat->getDisplay());
									next->show();
								} else if (strcmp(stat->getDesc().c_str(), "Email") == 0) {
									String email = stat->getDisplay();
									int ret = maPlatformRequest(("mailto:"+email).c_str());
									if (ret < 0 ) {
										ret = maPlatformRequest(email.c_str());
									}
									if (ret < 0) {
										MenuScreen *confirmation = new MenuScreen(RES_BLANK, "Feature currently not supported on device.");
										confirmation->setMenuWidth(170);
										confirmation->setMarginX(5);
										confirmation->setMarginY(5);
										confirmation->setDock(MenuScreen::MD_CENTER);
										confirmation->setListener(this);
										confirmation->setMenuFontSel(Util::getDefaultFont());
										confirmation->setMenuFontUnsel(Util::getDefaultFont());
										confirmation->setMenuSkin(Util::getSkinDropDownItem());
										confirmation->addItem("Ok");
										confirmation->show();
									}
								}
								else if ((strcmp(stat->getDesc().c_str(), "Web Address") == 0)||
										(strcmp(stat->getDesc().c_str(), "Social Media Link 1") == 0)||
										(strcmp(stat->getDesc().c_str(), "Social Media Link 1") == 0)||
										(strcmp(stat->getDesc().c_str(), "Social Media Link 1") == 0)||
										(strcmp(stat->getDesc().c_str(), "Social Media Link 1") == 0)||
										(strcmp(stat->getDesc().c_str(), "Social Media Link 1") == 0)) {
									String url = stat->getDisplay();
									//maPlatformRequest will only work if the url starts with http://
									//so we need to check for it, and add it if it isnt there
									if (url.find("http://") != 0) {
										url = "http://"+url;
									}
									int ret = maPlatformRequest(url.c_str());
									if (ret < 0) {
										MenuScreen *confirmation = new MenuScreen(RES_BLANK, "Feature currently not supported on device.");
										confirmation->setMenuWidth(170);
										confirmation->setMarginX(5);
										confirmation->setMarginY(5);
										confirmation->setDock(MenuScreen::MD_CENTER);
										confirmation->setListener(this);
										confirmation->setMenuFontSel(Util::getDefaultFont());
										confirmation->setMenuFontUnsel(Util::getDefaultFont());
										confirmation->setMenuSkin(Util::getSkinDropDownItem());
										confirmation->addItem("Ok");
										confirmation->show();
									}
								}
							}
						}
					}
				}
			} else {
				previous->show();
			}
			break;
	}
}
Beispiel #11
0
	Font::~Font() {
		if(mFontImage) {
			maDestroyObject(mFontImage);
			PlaceholderPool::put(mFontImage);
		}
	}
Beispiel #12
0
void ImageCache::connRecvFinished(MAUtil::Connection* conn, int result) {
	if (result >= 0) {
		mDataOffset += result;
		double val = (double)((double)mDataOffset/(double)mContentLength)*100;

		if (mNextRequest->getImage() != NULL) {
			if (mNextRequest->getType() == 0) {
				//normal loading
			} else if ((mNextRequest->getType() == 3)||(mNextRequest->getType() == 4)) {
				if (val <= 5.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP1));
				} else if (val <= 11) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP2));
				} else if (val <= 16.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP3));
				} else if (val <= 22) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP4));
				} else if (val <= 27.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP5));
				} else if (val <= 33) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP6));
				} else if (val <= 38.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP7));
				} else if (val <= 44) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP8));
				} else if (val <= 49.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP9));
				} else if (val <= 55) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP10));
				} else if (val <= 60.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP11));
				} else if (val <= 66) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP12));
				} else if (val <= 71.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP13));
				} else if (val <= 77) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP14));
				} else if (val <= 82.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP15));
				} else if (val <= 88) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP16));
				} else if (val <= 93.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP17));
				} else if (val <= 99) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING_FLIP18));
				}
				mNextRequest->getImage()->requestRepaint();
			} else if ((mNextRequest->getType() == 1)||(mNextRequest->getType() == 2)) {
				if (val <= 5.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING1));
				} else if (val <= 11) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING2));
				} else if (val <= 16.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING3));
				} else if (val <= 22) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING4));
				} else if (val <= 27.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING5));
				} else if (val <= 33) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING6));
				} else if (val <= 38.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING7));
				} else if (val <= 44) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING8));
				} else if (val <= 49.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING9));
				} else if (val <= 55) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING10));
				} else if (val <= 60.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING11));
				} else if (val <= 66) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING12));
				} else if (val <= 71.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING13));
				} else if (val <= 77) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING14));
				} else if (val <= 82.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING15));
				} else if (val <= 88) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING16));
				} else if (val <= 93.5) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING17));
				} else if (val <= 99) {
					maDestroyObject(mNextRequest->getImage()->getResource());
					mNextRequest->getImage()->setResource(Util::loadImageFromResource(RES_LOADING18));
				}
				mNextRequest->getImage()->requestRepaint();
			}
		}

		if((mContentLength - mDataOffset)>=0)
		{
			maWriteData(mData, mBuffer, mDataOffset-result, result);
			mHttp.recv(mBuffer, READSIZE);
		}
	} else if(result == CONNERR_CLOSED) {
		mContentLength = 0;
		finishedDownloading();
		mIsBusy = false;
	} else {
		mIsBusy = false;
	}
}