QByteArray OpCancelBookingResp::marshall() { QByteArray serialized_data; QDataStream stream(&serialized_data, QIODevice::WriteOnly); stream << localRequestId(); stream << opStatus(); stream << requestStatus(); return serialized_data; }
TVerdict CCTSYIntegrationTestCallCost0023::doTestStepL() /** * @SYMTestCaseID BA-CTSY-INT-CCOS-0023 * @SYMFssID BA/CTSY/CCOS-0023 * @SYMTestCaseDesc Get cost information. * @SYMTestPriority High * @SYMTestActions RMobilePhone::GetCostInfo * @SYMTestExpectedResults Pass - KErrNotSupported returned * @SYMTestType CIT * @SYMTestCaseDependencies live/automatic * * Reason for test: Verify KErrNotSupported is returned. * * @return - TVerdict code */ { // // SET UP // //Get cost information. //Verify KErrNotSupported is returned. RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone); // // SET UP END // StartTest(); // // TEST START // // Check RMobilePhone::GetCostInfo returns KErrNotSupported TExtEtelRequestStatus requestStatus(mobilePhone,EMobilePhoneGetCostInfo); RMobilePhone::TMobilePhoneCostInfoV1 costInfo; RMobilePhone::TMobilePhoneCostInfoV1Pckg costInfoPk(costInfo); mobilePhone.GetCostInfo(requestStatus, costInfoPk); ASSERT_EQUALS(WaitForRequestWithTimeOut(requestStatus, ETimeShort), KErrNone, _L("RMobilePhone::GetCostInfo did not complete.")) ASSERT_EQUALS(requestStatus.Int(),KErrNotSupported, _L("RMobilePhone::GetCostInfo completed with incorrect error")) // // TEST END // StartCleanup(); return TestStepResult(); }
// Internal state handling ---------------------------------------------------- uint8_t EndDevice::tick() { // Avoid reading packet in states that does not // check what the packet contains. switch(State) { case EndDeviceStart: case EndDeviceResetStart: case EndDeviceJoiningSend: case EndDeviceIdle: case EndDeviceSleeping: case EndDeviceWaking: case EndDeviceRequestSend: //case Error: //? break; default: xbee.readPacket(); } switch(State) { case EndDeviceStart: return start(); case EndDeviceFormingNetwork: return formingNetwork(); case EndDeviceJoiningSend: return joiningSend(); case EndDeviceJoiningWait: return joiningWait(); case EndDeviceJoiningWaitResponse: return joiningWaitResponse(); case EndDeviceIdle: return idle(); case EndDeviceSleepWait: return sleepWait(); case EndDeviceSleeping: return sleeping(); case EndDeviceError: return error(); case EndDeviceRequestSend: return requestSend(); case EndDeviceRequestStatus: return requestStatus(); case EndDeviceRequestWait: return requestWait(); case EndDeviceResetStart: return resetStart(); case EndDeviceResetWait: return resetWait(); case EndDeviceWaking: return waking(); default: { DEBUG_MSG("Bad state!"); } return TICK_UNKNOWN_ERROR; } }
void ApcUpsMon::timeout() { if (lastResponseTimestamp != 0 && (time(NULL) - lastResponseTimestamp) > expiryLimit) { // If we haven't received a response in a while, close the socket. // If there is a problem, this should generate diagnostics when // attempting to reconnect. lastResponseTimestamp = 0; // Otherwise we go in an infinite loop socket.abort(); } requestStatus(); if (qrand() < (RAND_MAX / 3)) { // Request events, on average, on one out of every three polls. // This is done to save bandwidth. requestEvents(); } }
LOCAL_C void AsyncDbOpenFollowedByAddGroupL() { test.Next(_L("Async database open & group creating")); TRequestStatus requestStatus(0); CContactOpenOperation* op = CContactDatabase::Open(KDatabaseFileName, requestStatus); // note: op doesn't have to be on CS User::WaitForRequest(requestStatus); CContactDatabase* database = op->TakeDatabase(); delete op; CleanupStack::PushL(database); CContactItem* tempGroup = database->CreateContactGroupL(_L("New Group")); delete tempGroup; CleanupStack::PopAndDestroy(database); }
LOCAL_C void TestAsyncOpenDbAndDeleteContactL() { //test if necesary sanity check was made test.Next( _L("Open async database and simulate a template delete event")); TRequestStatus requestStatus(0); CContactOpenOperation* op = CContactDatabase::Open(KDatabaseFileName, requestStatus); // note: op doesn't have to be on CS User::WaitForRequest(requestStatus); CContactDatabase* database = op->TakeDatabase(); CleanupStack::PushL(database); TContactItemId contactId = 1; //anything but not system template database->DeleteContactL(contactId); //aim is to check if it's safe to delete from template CleanupStack::PopAndDestroy(database); }
LOCAL_C void TestAsyncOpenDbAndDeleteTemplateL() { //test if necesary sanity check was made test.Next( _L("Open async database and simulate a template delete event")); TRequestStatus requestStatus(0); CContactOpenOperation* op = CContactDatabase::Open(KDatabaseFileName, requestStatus); // note: op doesn't have to be on CS User::WaitForRequest(requestStatus); CContactDatabase* database = op->TakeDatabase(); CleanupStack::PushL(database); //simulate a template remove event TContactDbObserverEvent event; event.iType = EContactDbObserverEventTemplateDeleted; database->HandleDatabaseEventL(event); CleanupStack::PopAndDestroy(database); }
TVerdict CCTSYIntegrationTestPhonePower0001::doTestStepL() /** * @SYMTestCaseID BA-CTSY-INT-PP-0001 * @SYMFssID BA/CTSY/PP-0001 * @SYMTestCaseDesc Get battery capabilities and information. Verify capabilities are correct and charge level is a valid percentage * @SYMTestPriority High * @SYMTestActions RMobilePhone::GetBatteryCaps, RMobilePhone::GetBatteryInfo * @SYMTestExpectedResults Pass - Battery caps and information returned. * @SYMTestType CIT * @SYMTestCaseDependencies live/automatic * * Reason for test: Verify capabilities are correct and charge level is a valid percentage. * * @return - TVerdict code */ { // // SET UP // // Get the battery capabilities and information. // Verify capabilities are correct and charge level is a valid percentage. RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone); // // SET UP END // StartTest(); // // TEST START // // Check RMobilePhone::GetBatteryCaps returns caps in set of KCapsGetBatteryInfo | KCapsNotifyBatteryInfoChange TUint32 batteryCaps; ASSERT_EQUALS(mobilePhone.GetBatteryCaps(batteryCaps), KErrNone, _L("RMobilePhone::GetBatteryCaps returned error")) TUint32 expectedCaps = RMobilePhone::KCapsGetBatteryInfo | RMobilePhone::KCapsNotifyBatteryInfoChange; TUint32 unwantedCaps = 0; ASSERT_BITS_SET(batteryCaps, expectedCaps, unwantedCaps, _L("RMobilePhone::GetBatteryCaps returned incorrect caps")) TExtEtelRequestStatus requestStatus(mobilePhone,EMobilePhoneGetBatteryInfo); RMobilePhone::TMobilePhoneBatteryInfoV1 batteryInfo; // Check RMobilePhone::GetBatteryInfo returns aInfo.iStatus = EPoweredByBattery // Check RMobilePhone::GetBatteryInfo returns aInfo.iChargeLevel > 0 but <= 100 mobilePhone.GetBatteryInfo(requestStatus, batteryInfo); ASSERT_EQUALS(WaitForRequestWithTimeOut(requestStatus, ETimeShort), KErrNone, _L("RMobilePhone::GetBatteryInfo did not complete.")) ASSERT_EQUALS(requestStatus.Int(),KErrNone , _L("RMobilePhone::GetBatteryInfo completed with incorrect error")) ASSERT_EQUALS(batteryInfo.iStatus,RMobilePhone::EPoweredByBattery, _L("RMobilePhone::GetBatteryInfo returned unexpected battery status")) ASSERT_TRUE(batteryInfo.iChargeLevel > 0 && batteryInfo.iChargeLevel <= 100 , _L("RMobilePhone::GetBatteryInfo returned incorrect charge level")) // // TEST END // StartCleanup(); return TestStepResult(); }
ChatWindow *MainWindow::createChatWindow(Contact& contact, bool show) { // Just open one window at a time to avoid duplicates createWindowMutex.lock(); ChatWindow *chat; QString jid = contact.jid; if (contact.type == Contact::TypeGroup) Utilities::logData("Group"); else Utilities::logData("Contact"); if (!chatWindowList.contains(jid)) { Utilities::logData("There's no previous chat window"); if (contact.type == Contact::TypeContact) chat = new ChatWindow(&contact,this); else chat = new GroupWindow((Group *)&contact,this); chatWindowList.insert(jid,chat); if (!lastContactsList.contains(jid)) { // This is a new chat and it is not in the // open chats list // Create the open chats item ChatDisplayItem *item = new ChatDisplayItem(&contact); lastContactsList.insert(jid,item); model->appendRow(item); // Set the last line logged in the item FMessage msg = chat->lastMessage(); item->updateData(msg); // Store this chat in the DB ConversationsDBEntry entry; entry.jid = jid; entry.muted = false; entry.muteExpireTimestamp = 0; chatsDB.createChat(entry); if (contact.type == Contact::TypeContact) emit subscribe(jid); } else { // This chat is in the open chats list // Configure mute settings ChatDisplayItem *item = lastContactsList.value(jid); if (item->muted) chat->setMute(item->muteExpireTimestamp); } chat->setAttribute(Qt::WA_DeleteOnClose); if (!show) Utilities::logData("Chat window will not be shown"); if (show) { Utilities::logData("Showing chat window"); qint64 startTime = QDateTime::currentMSecsSinceEpoch(); chat->show(); qint64 endTime = QDateTime::currentMSecsSinceEpoch() - startTime; Utilities::logData("Chat window showed " + QString::number(endTime) + " milliseconds."); } connect(chat,SIGNAL(sendMessage(FMessage)), this,SLOT(sendMessageFromChat(FMessage))); connect(chat,SIGNAL(destroyed(QObject *)), this,SLOT(deleteChat(QObject *))); connect(chat,SIGNAL(mute(QString,bool,qint64)), this,SLOT(mute(QString,bool,qint64))); connect(chat,SIGNAL(blockOrUnblockContact(QString,bool)), this,SLOT(blockOrUnblockContact(QString,bool))); connect(chat,SIGNAL(photoRefresh(QString,QString,bool)), this,SLOT(requestPhotoRefresh(QString,QString,bool))); connect(chat,SIGNAL(requestStatus(QString)), this,SLOT(requestContactStatus(QString))); connect(chat,SIGNAL(voiceNotePlayed(FMessage)), this,SLOT(sendVoiceNotePlayed(FMessage))); if (contact.type == Contact::TypeGroup) { GroupWindow *groupChat = (GroupWindow *) chat; connect(groupChat,SIGNAL(changeSubject(QString,QString)), this,SLOT(sendSetGroupSubjectFromChat(QString,QString))); connect(groupChat,SIGNAL(requestLeaveGroup(QString)), this,SLOT(requestLeaveGroupFromChat(QString))); connect(groupChat,SIGNAL(getParticipants(QString)), this,SLOT(requestGetParticipants(QString))); } else emit queryLastOnline(jid); }