int MAMain() { InitConsole(); gConsoleLogging = 1; int res = maSendTextSMS("0763113276", "Hello World!"); printf("Result: %i\n", res); FREEZE; }
void TradeFriendDetailScreen::mtxTagData(const char* data, int len) { if (strcmp(parentTag.c_str(), "result") == 0) { result = data; String check = data; if ((strcmp(method.c_str(), "phone_number") == 0)&&(!(check.find("User not found.")))) { maSendTextSMS(friendDetail.c_str(), check.substr(16).c_str()); result = "User not found. Invite Sent."; } else { result = data; } } else { result = "Error inviting friend."; } if (card != NULL) { drawCompleteScreen(); } else { notice->setCaption(result); } }
void NoteScreen::keyPressEvent(int keyCode) { Widget *currentSoftKeys = mainLayout->getChildren()[mainLayout->getChildren().size() - 1]; switch(keyCode) { case MAK_SOFTLEFT: note = editBoxNote->getCaption(); switch (screenType) { case ST_CARD_NOTE: if (!isBusy) { isBusy = true; if (note.length() > 0) { encodedNote = Util::base64_encode(reinterpret_cast<const unsigned char*>(note.c_str()),note.length()); card->setNote(encodedNote.c_str()); //work out how long the url will be, the 15 is for the & and = symbals, as well as hard coded parameters int urlLength = 46 + URLSIZE + encodedNote.length() + card->getId().length(); char *url = new char[urlLength+1]; memset(url,'\0',urlLength+1); sprintf(url, "%s?savenote=%s&cardid=%s", URL, encodedNote.c_str(), card->getId().c_str()); lprintfln("%s", url); if(mHttp.isOpen()){ mHttp.close(); } mHttp = HttpConnection(this); int res = mHttp.create(url, HTTP_GET); if(res < 0) { notice->setCaption("Error updating note"); } else { mHttp.setRequestHeader("AUTH_USER", feed->getUsername().c_str()); mHttp.setRequestHeader("AUTH_PW", feed->getEncrypt().c_str()); feed->addHttp(); mHttp.finish(); notice->setCaption("Updating note..."); } delete [] url; url = NULL; } else { notice->setCaption("Nothing to save."); } } break; case ST_SMS: if (note.length() > 0) { maSendTextSMS(detail.c_str(), note.c_str()); } break; } break; case MAK_BACK: case MAK_SOFTRIGHT: editBoxNote->setSelected(false); editBoxNote->disableListener(); clearListBox(); previous->show(); break; case MAK_FIRE: if(currentSoftKeys->getChildren()[0]->isSelected()){ keyPressEvent(MAK_SOFTLEFT); }else if(currentSoftKeys->getChildren()[2]->isSelected()){ keyPressEvent(MAK_SOFTRIGHT); } break; case MAK_UP: if(currentSelectedKey!=NULL){ currentSelectedKey->setSelected(false); currentSelectedKey = NULL; currentKeyPosition = -1; kinListBox->getChildren()[kinListBox->getChildren().size()-1]->setSelected(true); } break; case MAK_DOWN: if(currentSelectedKey==NULL){ kinListBox->getChildren()[kinListBox->getChildren().size()-1]->setSelected(false); for(int i = 0; i < currentSoftKeys->getChildren().size();i++){ if(((Button *)currentSoftKeys->getChildren()[i])->isSelectable()){ currentKeyPosition=i; currentSelectedKey= currentSoftKeys->getChildren()[i]; currentSelectedKey->setSelected(true); break; } } } break; case MAK_LEFT: if(currentSelectedKey!=NULL){ if(currentKeyPosition > 0){ currentKeyPosition = currentKeyPosition - 1; for(int i = currentKeyPosition; i >= 0;i--){ if(((Button *)currentSoftKeys->getChildren()[i])->isSelectable()){ currentSelectedKey->setSelected(false); currentKeyPosition=i; currentSelectedKey= currentSoftKeys->getChildren()[i]; currentSelectedKey->setSelected(true); break; } } } } break; case MAK_RIGHT: if(currentSelectedKey!=NULL){ if(currentKeyPosition+1 < currentSelectedKey->getParent()->getChildren().size()){ currentKeyPosition = currentKeyPosition + 1; for(int i = currentKeyPosition; i < currentSoftKeys->getChildren().size();i++){ if(((Button *)currentSoftKeys->getChildren()[i])->isSelectable()){ currentSelectedKey->setSelected(false); currentKeyPosition=i; currentSelectedKey= currentSoftKeys->getChildren()[i]; currentSelectedKey->setSelected(true); break; } } } } break; } }