static void EEPROMWriteReadTestHandler(SignalType * Signal) { switch (Signal->Event) { case EE_PRIMITIVE: switch (Signal->SubEvent) { case EE_READ_DATA_cfm: { char* ptr; EeStoreDataReqType *EeStoreDataReq; ptr = StringPrint(StatusString, "EE_READ_DATA_cfm["); ptr = StrPrintHexWord(ptr, EEP_UserDataArea); ptr = StringPrint(ptr, "]=["); ptr = StrPrintHexByte(ptr, eepromData[0]); ptr = StringPrint(ptr, "]"); PrintStatus(0, StatusString); eepromData[0]++; NewSignal(sizeof(EeStoreDataReqType) + 1, (void **) &EeStoreDataReq); getSignalData(EeStoreDataReq)[0] = eepromData[0]; EeStoreDataReq->DataTypes = EEDT_ANYADDRESS; EeStoreDataReq->SubsNo = 0; setAddressData(EEP_UserDataArea, 1); SendSignal((SignalType *) EeStoreDataReq, EE_PROCESS_ID, EE_PRIMITIVE, EE_STORE_DATA_req); setSignalHandler(APPLICATION_PROCESS_ID_PP, PPconnectionHandler, 0); } break; } } DeleteBuffer(Signal); }
static void PPAlreadySubscribedHandler(SignalType * Signal) { switch (Signal->Event) { case IWU_PRIMITIVE: { switch (Signal->SubEvent) { case OM_SUBS_SELECT_cfm: { OmSubsSelectCfmType *OmSubsSelectCfm = (OmSubsSelectCfmType *) Signal; if (OmSubsSelectCfm->NotAccepted) { PrintStatus(0, "Login to subscribed base failed!"); } } break; case OM_SUBS_STATUS_ind: { OmSubsStatusIndType *OmSubsStatusInd = (OmSubsStatusIndType *) Signal; if (OmSubsStatusInd->Status & SS_LocRegSucceeded) { PrintStatus(0, "Login to subscribed base completed"); } else if (OmSubsStatusInd->Status & SS_Locked) { PrintStatus(0, "Locked to subscribed base"); } else if (OmSubsStatusInd->Status & SS_Subscripted) { _sprintf_(StatusString, "Subscription number [%02x]", OmSubsStatusInd->SubsNo); PrintStatus(0, StatusString); } } break; case OM_ATTACH_ind: { OmAttachIndType * OmAttachInd = (OmAttachIndType *) Signal; IwuToIwuType * IwuToIwuPtr; IwuToIwuPtr = (IwuToIwuType *) FindInfoElement(IwuToIwuId, getOmAttachIndTypeIE(OmAttachInd) - 2, OmAttachInd->SignalHeader.SignalLength - sizeof(OmAttachIndType) + 2); if (IwuToIwuPtr != NULL) { if (IwuToIwuPtr->ProtocolDiscrim == UserSpecific && IwuToIwuPtr->DiscrimType == UseOfEmc) { StandByTxtIEType *standbyText = (StandByTxtIEType *) FindInfoElement(StandByTxtAPEIEId, getIwuToIwuSIE(IwuToIwuPtr) - 2, OmAttachInd->SignalHeader.SignalLength - sizeof(OmAttachIndType) - sizeof(IwuToIwuType) + 2); if (standbyText) { memcpy(StatusString, standbyText->StandByTxt, standbyText->LengthOfContents); StatusString[standbyText->LengthOfContents] = '\0'; PrintStatus(0, StatusString); } } } setSignalHandler(APPLICATION_PROCESS_ID_PP, PPLockedHandler, 0); } } } break; } DeleteBuffer(Signal); }
// Crash recovery signal handler static void crashHandler(int sigId) { setSignalHandler(SIG_DFL); fprintf(stderr, "*** BibleTime got signal %d (Crashing). Trying to save settings.\n", sigId); if (CBTConfig::get(CBTConfig::crashedLastTime)) { // crashed this time and the execution before this one, // probably a bug which occurs every time CBTConfig::set(CBTConfig::crashedTwoTimes, true); } else { //try to restore next time. CBTConfig::set(CBTConfig::crashedLastTime, true); } if (bibletime_ptr) { bibletime_ptr->saveSettings(); fprintf(stderr, "*** Saving seemed to be successful. If restoring does not work on next startup please use the option --ignore-session\n"); } // Return to DrKonqi. }
// Crash recovery signal handler static void signalHandler(int sigId) { setSignalHandler(SIG_DFL); fprintf(stderr, "*** BibleTime got signal %d (Exiting)\n", sigId); // try to cleanup all windows if (CBTConfig::get(CBTConfig::crashedLastTime)) { //crashed this time and the execution before this one, probably a bug which occurs every time CBTConfig::set(CBTConfig::crashedTwoTimes, true); } else { //try to restore next time. CBTConfig::set(CBTConfig::crashedLastTime, true); } if (bibletime_ptr) { bibletime_ptr->saveSettings(); fprintf(stderr, "*** Saving seemed to be successful. If restoring does not work on next startup please use the option --ignore-session\n"); } ::exit(-1); //exit BibleTime }
static void PPDialingHandler(SignalType * Signal) { switch (Signal->Event) { case IWU_PRIMITIVE: { switch (Signal->SubEvent) { case CC_CONNECT_prim: { SignalType * startAudio; NewBuffer(sizeof(SignalType), (void**) &startAudio); SendSignal((SignalType*) startAudio, DSP_PROCESS_ID, SETUPAUDIO_EVENT, 0); connected = 1; } case CC_INFO_prim: /*do not break*/ { if (connected == 1) { SignalType* mySignal; NewSignal(sizeof(SignalType) + 2 + strlen(numberToDial), (void **) &mySignal); getSignalData(mySignal)[0] = 0x2c; getSignalData(mySignal)[1] = strlen(numberToDial); memcpy(getSignalData(mySignal) + 2, numberToDial, strlen(numberToDial)); InjectSignal(mySignal, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_INFO_prim, Signal->SessionId); } } break; case CC_RELEASE_prim: { if (connected == 1) { Signal->SignalLength = sizeof(CcReleaseComPrimType); SendSignal(Signal, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_RELEASE_COM_prim); connected = 0; setSignalHandler(APPLICATION_PROCESS_ID_PP, PPconnectionHandler, 0); return; } } break; } } } DeleteBuffer(Signal); }
/* Main code execution starts here */ int main(int argc, char **argv) { /* Writes our opening message to log file */ logMessage("Open Program"); /* Used to store the port number argument */ int port; int result; /* Used for creating and binding the socket */ int socketID; /* Initialize our global for our signal handler */ Exit = 0; /* Sets the signals */ setSignalHandler(); /* Assigns the port and checks error */ result = portAssign(&port, argc, argv); checkError(result, PORT_ASSIGN_STATUS); if(result == -1) return (1); /* Construct socket, binds and listens */ socketID = setSocket(port); checkError(result, SOCKET_ASSIGN_STATUS); if(socketID == -1) return (1); /* Accepts clients and allows communication*/ runServer(socketID); /* Close socket connection */ result = close( socketID ); checkError(result, SOCKET_CLOSE_STATUS); if(result != -1) printf("Server closed.\n"); /* Log final message and end program */ logMessage("Close Program\n"); return(0); }
serialSignal_t::serialSignal_t ( char const *devName, serialSignalHandler_t handler ) : fd_( open( devName, O_RDWR ) ) , handler_( handler ) { if( isOpen() ){ setRaw( fd_ ); if( 0 == serialSignal_ ){ serialSignal_ = nextRtSignal(); } fcntl(fd_, F_SETOWN, getpid()); fcntl(fd_, F_SETSIG, serialSignal_ ); sigset_t blockThese ; sigemptyset( &blockThese ); setSignalHandler( serialSignal_, blockThese, serialSignalHandler, this ); if( 0 != handler_ ){ int flags = flags = fcntl( fd_, F_GETFL, 0 ); flags |= FASYNC ; fcntl( fd_, F_SETFL, flags | O_NONBLOCK ); } } }
int main(void) { int sfd, cfd, epfd, nfds; struct epoll_event ctlevt, events[MAX_EVENT_NUM], *p_evts; struct sockaddr_un sun; socklen_t sunlen; char str[STR_LENGTH]; int ii; sfd = socket( AF_UNIX, SOCK_STREAM, 0); /* protocol */ if( sfd < 0) { errexit(__func__, __LINE__); } memset( &sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX; strncpy( sun.sun_path, SOCKET_PATH, sizeof(sun.sun_path) - 1); if( bind( sfd, (struct sockaddr*)&sun, sizeof(sun)) < 0) { errexit(__func__, __LINE__); } setSignalHandler(); /* if SIGINT then unlink(SOCKET_PATH) */ if( listen( sfd, LISTEN_BACKLOG) < 0) { errexit(__func__, __LINE__); } epfd = epoll_create1(0); if(epfd < 0) { errexit(__func__, __LINE__); } ctlevt.events = EPOLLIN; ctlevt.data.fd = sfd; if( epoll_ctl( epfd, EPOLL_CTL_ADD, sfd, &ctlevt) < 0) { errexit(__func__, __LINE__); } printf("epoll_wait() then waiting...\n"); nfds = epoll_wait( epfd, events, MAX_EVENT_NUM, -1); /* timeout: unlimited*/ for(ii = 0; ii < nfds; ii++) { p_evts = &events[ii]; if(p_evts->data.fd == sfd) { sunlen = sizeof(sun); cfd = accept( sfd, (struct sockaddr*)&sun, &sunlen); if( cfd < 0) { errexit(__func__, __LINE__); } printf("accept() ok.\n"); } } read( cfd, str, sizeof(str)); printf("[s] %s\n", str); strncpy( str, "HELLO", sizeof(str) - 1); write( cfd, str, sizeof(str)); close(sfd); close(cfd); unlink(SOCKET_PATH); printf("[s] bye\n"); return 0; }
int main(void) { int sfd1, sfd2, cfd1, cfd2, epfd, nfds; struct epoll_event ctlevt, events[MAX_EVENT_NUM], *p_evts; struct sockaddr_un sun; socklen_t sunlen; char str[STR_LENGTH]; int ii; unlink(SOCKET_PATH_CL1); unlink(SOCKET_PATH_CL2); UNIX_SOCK_BIND(sfd1, SOCKET_PATH_CL1); UNIX_SOCK_BIND(sfd2, SOCKET_PATH_CL2); setSignalHandler(); /* if SIGINT then unlink(SOCKET_PATH) */ if( listen( sfd1, LISTEN_BACKLOG) < 0) { errexit(__func__, __LINE__); } if( listen( sfd2, LISTEN_BACKLOG) < 0) { errexit(__func__, __LINE__); } epfd = epoll_create1(0); if(epfd < 0) { errexit(__func__, __LINE__); } MY_EPOLL_CTL(sfd1, EPOLL_CTL_ADD, EPOLLIN); MY_EPOLL_CTL(sfd2, EPOLL_CTL_ADD, EPOLLIN); printf("epoll_wait() then waiting...\n"); while('u') { nfds = epoll_wait( epfd, events, MAX_EVENT_NUM, -1); /* timeout: unlimited*/ printf( "\n%d event occured !\n", nfds); for(ii = 0; ii < nfds; ii++) { p_evts = &events[ii]; if(p_evts->data.fd == sfd1) { printf("sfd1 !\n"); UNIX_SOCK_ACCEPT(sfd1, cfd1); MY_EPOLL_CTL(sfd1, EPOLL_CTL_DEL, EPOLLIN); close(sfd1); sfd1 = 0; MY_EPOLL_CTL(cfd1, EPOLL_CTL_ADD, EPOLLIN); } if(p_evts->data.fd == sfd2) { printf("sfd2 !\n"); UNIX_SOCK_ACCEPT(sfd2, cfd2); MY_EPOLL_CTL(sfd2, EPOLL_CTL_DEL, EPOLLIN); close(sfd2); sfd2 = 0; MY_EPOLL_CTL(cfd2, EPOLL_CTL_ADD, EPOLLIN); } if(p_evts->data.fd == cfd1) { if(p_evts->events & EPOLLIN) { printf("cfd1 R !\n"); read( cfd1, str, sizeof(str)); printf("[s] %s\n", str); MY_EPOLL_CTL(cfd1, EPOLL_CTL_MOD, EPOLLOUT); } if(p_evts->events & EPOLLOUT) { printf("cfd1 W !\n"); strncpy( str, "HELLO", sizeof(str) - 1); write( cfd1, str, sizeof(str)); close(cfd1); cfd1 = 0; } } if(p_evts->data.fd == cfd2) { if(p_evts->events & EPOLLIN) { printf("cfd2 R !\n"); read( cfd2, str, sizeof(str)); printf("[s] %s\n", str); MY_EPOLL_CTL(cfd2, EPOLL_CTL_MOD, EPOLLOUT); } if(p_evts->events & EPOLLOUT) { printf("cfd2 W !\n"); strncpy( str, "WORLD", sizeof(str) - 1); write( cfd2, str, sizeof(str)); close(cfd2); cfd2 = 0; } } } } unlink(SOCKET_PATH_CL1); unlink(SOCKET_PATH_CL2); printf("[s] bye\n"); return 0; }
void PPconnectionHandler(SignalType * Signal) { switch (Signal->Event) { case APPLICATION_PRIMITIVE: { switch (Signal->SubEvent) { case MSFInd: { AppMSFType* msfInd = (AppMSFType*) Signal; char* msf = mem_malloc(msfInd->length + 1, 100); memcpy(msf, getAppMSFTypeIE(msfInd), msfInd->length); msf[msfInd->length] = '\0'; PrintStatus(0, msf); if (strlen(msf) > 4) { if (memcmp(msf, "DIAL", 4) == 0) { char *number = &msf[4]; if (strlen(number) < 5) { TimerType * timer = NewTimer(APPLICATION_PROCESS_ID_PP, WAIT_CONNECTION, 0); StartTimer(timer, 200); /* wait 2 sec before dialing call*/ memcpy(numberToDial, number, strlen(number)); numberToDial[strlen(number)] = '\0'; } } } mem_free(msf); break; } } } break; case IWU_PRIMITIVE: { switch (Signal->SubEvent) { case CC_SETUP_prim: { char* ptr; char CallingPartyNo[INFO_BUFSIZE]; CcSetupPrimType *CcSetupPrim = (CcSetupPrimType *) Signal; CallingPartyNoType *CallingPartyNoPtr; SignalIEType *SignalIE; TimerType * timer = NewTimer(APPLICATION_PROCESS_ID_PP, OFFHOOKTIMER, 0); StartTimer(timer, 200); /* wait 2 sec before accepting call*/ CallingPartyNoPtr = (CallingPartyNoType *) FindInfoElement(CallingPartyNoId, getCcSetupPrimTypeIE(CcSetupPrim) - 2, CcSetupPrim-> SignalHeader. SignalLength - sizeof(CcSetupPrimType) + 2); GetCallingPartyNo(CallingPartyNoPtr, CallingPartyNo, 32); SignalIE = (SignalIEType *) FindInfoElement(SignalId, getCcSetupPrimTypeIE(CcSetupPrim) - 2, CcSetupPrim->SignalHeader. SignalLength - sizeof(CcSetupPrimType) + 2); if (SignalIE) { } else { PrintStatus(0, "No SignalIE! EXTERNAL_RING"); } Signal->SignalLength = sizeof(CcAlertingPrimType); SendSignal(Signal, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_ALERTING_prim); ptr = StringPrint(StatusString, "CallingPartyNo ["); ptr = StringPrint(ptr, CallingPartyNo); ptr = StringPrint(ptr, "]"); PrintStatus(0, StatusString); connected = 1; return; } case CC_RELEASE_COM_prim: break; case CC_RELEASE_prim: { SignalType* stopAudio; Signal->SignalLength = sizeof(CcReleaseComPrimType); SendSignal(Signal, IWU_PROCESS_ID, IWU_PRIMITIVE, CC_RELEASE_COM_prim); NewSignal(sizeof(SignalType), (void**) &stopAudio); SendSignal((SignalType*) stopAudio, DSP_PROCESS_ID, STOPAUDIO_EVENT, 0); return; } case CC_CONNECT_ACK_prim: { EeReadDataReqType *EeReadDataReq; NewSignal(sizeof(EeReadDataReqType) + sizeof(void *), (void **) &EeReadDataReq); EeReadDataReq->ReturnTIPD = TIPD_APPLICATION; EeReadDataReq->DataTypes = EEDT_ANYADDRESS; /* getEeReadDataReqTypeDataPtr(EeReadDataReq)[0] = (void *) &eepromData; */ memset(&eepromData, 0x00, 1); setAddressData(EEP_UserDataArea, 1); SendSignal((SignalType *) EeReadDataReq, EE_PROCESS_ID, EE_PRIMITIVE, EE_READ_DATA_req); setSignalHandler(APPLICATION_PROCESS_ID_PP, EEPROMWriteReadTestHandler, 0); } break; case CC_CONNECT_prim: { if (firsttime) { UByte * tmp; /* UByte cnt;*/ /*MuteTransmitter();*/ /*for (cnt=0; cnt < 6; cnt++)*/ { tmp = pp_get_speech_buffer(0); if (tmp != 0) { UByte count; char* ptr; ptr = StringPrint(StatusString, "***Buffer: ["); ptr = StrPrintHexAddr(ptr, (unsigned long) tmp); for (count = 0; count < 40; count++) { tmp[count] = 0x00; } tmp[0] = 0xCA; tmp[1] = 0xFE; tmp[2] = 0xBA; tmp[3] = 0xBE; tmp[4] = 0; tmp[5] = 0; tmp[6] = 0xff; tmp[7] = 0xff; ptr = StringPrint(ptr, "]"); PrintStatus(0, StatusString); { TimerType* connectionTimer = NewTimer(APPLICATION_PROCESS_ID_PP, PEIODICTIMER, 0); StartTimer(connectionTimer, 500); /* Wait 1 sec*/ PrintStatus(0, "start the timer"); } } else { PrintStatus(0, "tmp==0"); } } firsttime = 0; } } case CC_INFO_prim: /*do not break*/ break; case CC_SETUP_ACK_prim: break; case CC_CALL_PROC_prim: break; case CC_ALERTING_prim: break; case SS_SETUP_prim: handle_ss_setup(Signal); break; case SS_FACILITY_prim: handle_ss_facility(Signal); break; default: { char* ptr; ptr = StringPrint(StatusString, "Unknown IWU_PRIMITIVE [0x"); ptr = StrPrintHexByte(ptr, Signal->SubEvent); ptr = StringPrint(ptr, "]"); PrintStatus(0, StatusString); } } } break; case TIME_OUT_EVENT: { switch (Signal->SubEvent) { case SENDMSFTIMER: { /* PrintStatus(0, "Sending MSF");*/ /* SendMsfMessage("2001", "OK!");*/ } break; case WAIT_CONNECTION: { callUser_PP(numberToDial, 0); setSignalHandler(APPLICATION_PROCESS_ID_PP, PPDialingHandler, 0); } break; case OFFHOOKTIMER: { if (connected) { PrintStatus(0, "Accepting call!"); off_hook(); } } break; case PEIODICTIMER: { UByte * tmp; TimerType* connectionTimer = NewTimer(APPLICATION_PROCESS_ID_PP, PEIODICTIMER, 0); PrintStatus(0, "PEIODICTIMER"); StartTimer(connectionTimer, 500); /* Wait 1 sec*/ tmp = pp_get_speech_buffer(1); if (tmp != 0) { int c; char* ptr; ptr = StringPrint(StatusString, "***Buffer: ["); ptr = StrPrintHexAddr(ptr, (unsigned long) tmp); ptr = StringPrint(ptr, "-"); for (c = 0; c < 8; c++) { ptr = StrPrintHexByte(ptr, tmp[c]); ptr = StringPrint(ptr, ","); } ptr = StringPrint(ptr, "]"); PrintStatus(0, StatusString); } else { PrintStatus(0, "tmp==0"); } } break; default: { PrintStatus(0, "Unknown TIME_OUT_EVENT in connection handler"); } } } break; default: { PrintStatus(0, "Unknown event to connection handler"); } } DeleteBuffer(Signal); }
int main(int argc, char* argv[]) { qInstallMsgHandler( myMessageOutput ); //create about data for this application static KCmdLineOptions options[] = { {"debug", I18N_NOOP("Enable debug messages"),0}, {"ignore-session", I18N_NOOP("Ignore the startup session that was saved when BibleTime was closed the last time."),0}, {"open-default-bible <key>", I18N_NOOP("Open the standard Bible with the given key. Use <random> to open at a random position."),0}, //{"install-local <path>", I18N_NOOP("Open the SwordSetup dialog to install works from <path>"),0}, {0,0,0} }; KAboutData aboutData( PACKAGE, "BibleTime", VERSION, I18N_NOOP("Bible study tool for KDE"), KAboutData::License_GPL_V2, I18N_NOOP("(c)1999-2007, The BibleTime Team"), I18N_NOOP("BibleTime is an easy to use but powerful Bible study tool for KDE.\n\nWe are looking for developers and translators.\nIf you'd like to join our team, please send an email to [email protected]."), "http://www.bibletime.info/", "*****@*****.**" ); /*********************************************** * Active developers (sorted by last name) * ************************************************/ // Project coordination aboutData.addAuthor("Joachim Ansorg", I18N_NOOP("Project coordinator"), "*****@*****.**", "http://www.joachim-ansorg.de/"); // Second main developer aboutData.addAuthor("Martin Gruner", I18N_NOOP("Frontend, backend"), "*****@*****.**", ""); // artwork aboutData.addAuthor("James Ots", I18N_NOOP("Crystal icons, crystal startlogo, webpage"), "*****@*****.**", "http://www.jamesots.com"); //inactiv /*********************************************** * Credits (sorted by last name) * ************************************************/ // Update to the Romanian GUI translation aboutData.addCredit("Horatiu Alexe", I18N_NOOP("Romanian translation"), ""); //highcolor icons, startlogo for BT <= 1.4 aboutData.addCredit("David Blue", I18N_NOOP("High contrast template"), "*****@*****.**"); //helped out with the installation manager aboutData.addCredit("Tim Brodie", I18N_NOOP("Installation manager"),"*****@*****.**", ""); //first set of icons and the first startup logos aboutData.addCredit("Timothy R. Butler", I18N_NOOP("Icons, startlogo"), "*****@*****.**", "http://www.uninetsolutions.com"); //GUI improvements aboutData.addCredit("Jim Campbell", I18N_NOOP("GUI"), "*****@*****.**", ""); //Indexed search, gui improvements aboutData.addCredit("Lee Carpenter", I18N_NOOP("GUI, instant search"),"Lee Carpenter <*****@*****.**>", "http://www.carpie.net"); //Translations into Traditional and Simplified Chinese aboutData.addCredit("Chun-shek Chan", I18N_NOOP("GUI translations into Traditional and Simplified Chinese"), "*****@*****.**", ""); //Binary packages of CLucene, BibleTime and Sword for Fedore, SUSE, Mandriva aboutData.addCredit("Jeremy Erickson", I18N_NOOP("Binary packages"), "", ""); //Started the Crosswire porject, also contributed some code aboutData.addCredit("Troy A. Griffits", I18N_NOOP("Founder of the Sword project"), "*****@*****.**", "http://www.crosswire.org/"); //Sponsored many years the www.bibletime.de domain! aboutData.addCredit("Thomas Hagedorn", I18N_NOOP("Sponsored our internet domain for many years"), "*****@*****.**", ""); //He provided us with the Bible Study HowTo aboutData.addCredit("Bob Harman", I18N_NOOP("Bible Study HowTo"), "*****@*****.**", ""); // and / or search for multiple words, other fixes and improvements aboutData.addCredit("Nikolay Igotti", I18N_NOOP("Search dialog enhancements"), "*****@*****.**", ""); // Language codes iso639-1, iso639-2 and SIL language codes aboutData.addCredit("SIL International", I18N_NOOP("Language codes and names"), "", "http://www.ethnologue.com/iso639"); //Patch for the mag delay (2007-03-22) aboutData.addCredit("Eeli Kaikkonen", I18N_NOOP("GUI improvements"),"*****@*****.**", ""); //Update the the Finnish GUI translation aboutData.addCredit("Ilpo Kantonen", I18N_NOOP("Finnish translation"),"", ""); //Smaller frontend enhancements aboutData.addCredit("Chris Kujawa", I18N_NOOP("Frontend"),"*****@*****.**", ""); //Update to the Czech GUI translation aboutData.addCredit("Pavel Lauko", I18N_NOOP("Czech translation"),"", ""); //Smaller searchdialog enhancements aboutData.addCredit("Mark Lybarger", I18N_NOOP("Searchdialog"), "*****@*****.**",""); //Polish GUI translation update aboutData.addCredit("Piotr Markiewicz", I18N_NOOP("Polish translation"), "*****@*****.**", ""); //Smaller frontend enhancements aboutData.addCredit("Luke Mauldin", I18N_NOOP("Frontend"), "*****@*****.**", ""); //translated parts of the russian website files aboutData.addCredit("Igor Rykhlin", I18N_NOOP("Russian website translation"), "", ""); // update to the Spanish website translation aboutData.addCredit("Gabriel Pérez", I18N_NOOP("Spanish website translation updates"), "", ""); //Update to the russian website translation aboutData.addCredit("Igor Plisco", I18N_NOOP("Update to the russian website translation"), "", ""); // handbook documentation aboutData.addCredit("Fred Saalbach", I18N_NOOP("Documentation"), "*****@*****.**", ""); // Original Russian website translator aboutData.addCredit("Vlad Savitsky", I18N_NOOP("Russian website translation"), "", ""); // comitted search in default bible, opened modules, other smaller things aboutData.addCredit("Gary Sims", I18N_NOOP("Search dialog enhancements"), "*****@*****.**", ""); // Very helpful testing aboutData.addCredit("Wolfgang Stradner", I18N_NOOP("Very helpful and detailed testing"), "*****@*****.**", ""); //The first lead developer aboutData.addCredit("Torsten Uhlmann", I18N_NOOP("The first lead developer"), "", ""); //Update of the dutch website translation aboutData.addCredit("Johan van der Lingen", I18N_NOOP("Translation updates for the Dutch GUI, the website and the handbook"), "", ""); //French handbook translation aboutData.addCredit("Jean Van Schaftingen", I18N_NOOP("French handbook translation"), "", ""); //scoped_ptr and related classes aboutData.addCredit("David White", I18N_NOOP("Helpful source code additions"), "", "http://www.wesnoth.org/"); //Translated the GUI into Russian aboutData.addCredit("Dmitry Yurevich", I18N_NOOP("Translated the GUI into Russian"), "", ""); //The new keychooser for Bible modules aboutData.addCredit("Mark Zealey", I18N_NOOP("New Bible key choosers"), "*****@*****.**", ""); //Update to the Spanish GUI translation aboutData.addCredit("Esteban Zeller", I18N_NOOP("Spanish translation"), "", ""); //special message so the translator get his credits in the about box, don't remove this! QString dummy = I18N_NOOP("_: NAME OF TRANSLATORS\nYour names"); //translator's name dummy = I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"); //translators eMail KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); BibleTimeApp app; KGlobal::dirs()->addResourceType("BT_pic", "share/apps/bibletime/pics"); KGlobal::dirs()->addResourceType("BT_DisplayTemplates", "share/apps/bibletime/display-templates"); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); // A binary option (on / off) if (args->isSet("debug")) { showDebugMessages = true; } if (kapp->isRestored()) { // qWarning("Restoring BibleTime"); //RESTORE( BibleTime ); int n = 1; while (KMainWindow::canBeRestored(n)){ if (KMainWindow::classNameOfToplevel(n) == QString("BibleTime")) { bibletime_ptr = new BibleTime; bibletime_ptr->restore(n); } n++; } bibletime_ptr->restoreWorkspace(); } else { const bool showIt = CBTConfig::get(CBTConfig::logo); if(showIt) { KStartupLogo::createSplash(); KStartupLogo::showSplash(); KStartupLogo::setStatusMessage( i18n("Starting BibleTime") + QString("...") ); } setSignalHandler(signalHandler); // compatibility stuff for 1.3, needs to be moved to better place later if (CBTConfig::get(CBTConfig::bibletimeVersion) != VERSION) { KStandardDirs stdDirs; QDir dir(stdDirs.saveLocation("data", "bibletime/")); if (!dir.exists("sessions/") && dir.exists("profiles/")) { //only old dir exists dir.rename("profiles", "sessions"); } } bibletime_ptr = new BibleTime(); // a new BibleTime version was installed (maybe a completely new installation) if (CBTConfig::get(CBTConfig::bibletimeVersion) != VERSION) { KStartupLogo::hideSplash(); CBTConfig::set(CBTConfig::bibletimeVersion, VERSION); bibletime_ptr->slotSettingsOptions(); } //The tip of the day if (CBTConfig::get(CBTConfig::tips)) { KStartupLogo::hideSplash(); bibletime_ptr->slotHelpTipOfDay(); } // restore the workspace and process command line options app.setMainWidget(bibletime_ptr); bibletime_ptr->show(); bibletime_ptr->processCommandline(); //must be done after the bibletime window is visible if (showIt) { KStartupLogo::hideSplash(); KStartupLogo::deleteSplash(); } } const int ret = app.exec(); delete bibletime_ptr; return ret; }
void ApplicationSignalHandler_PP(SignalType * Signal) { switch (Signal->Event) { case IWU_PRIMITIVE: { switch (Signal->SubEvent) { case OM_SUBS_STATUS_ind: { OmSubsStatusIndType *OmSubsStatusInd = (OmSubsStatusIndType *) Signal; if (OmSubsStatusInd->Status) { OmSubsSelectReqType *OmSubsSelectReq; NewBuffer(sizeof(OmSubsSelectReqType), (void **) &OmSubsSelectReq); OmSubsSelectReq->SignalHeader.SignalLength = sizeof(OmSubsSelectReqType); OmSubsSelectReq->SubsNo = 0; InjectSignal((SignalType *) OmSubsSelectReq, IWU_PROCESS_ID, IWU_PRIMITIVE, OM_SUBS_SELECT_req, 0); switch (OmSubsStatusInd->Status) { case SS_Locked: { setSignalHandler(APPLICATION_PROCESS_ID_PP, PPNotSubscribedHandler, 0); } break; case SS_Locked | SS_Subscripted: case SS_Subscripted: { setSignalHandler(APPLICATION_PROCESS_ID_PP, PPAlreadySubscribedHandler, 0); } break; } } } } } break; case INITIALIZE_EVENT: { TimerType * timer = NewTimer(APPLICATION_PROCESS_ID_PP, WAIT_FOR_INIT, 0); StartTimer(timer, 200); } break; case TIME_OUT_EVENT: { switch (Signal->SubEvent) { case WAIT_FOR_INIT: { SignalType * ActivateSignal; EeReadDataReqType *EeReadDataReq; ProcessIdType ProcessId = IWU_PROCESS_ID; EventType Event = ACTIVATE_EVENT; SubEventType SubEvent = 0; NewSignal(sizeof(SignalType), (void**) &ActivateSignal); InjectSignal(ActivateSignal, ProcessId, Event, SubEvent, 0); NewSignal(offsetof(EeReadDataReqType, DataTypes) + sizeof(U16Bits) + 2 * sizeof(void *), (void **) &EeReadDataReq); EeReadDataReq->ReturnTIPD = PD_LCE; EeReadDataReq->SubsNo = 0; EeReadDataReq->DataTypes = EEDT_Ipei; getEeReadDataReqTypeDataPtr(EeReadDataReq)[0] = (void *) &HandsetIPEI[0]; InjectSignal((SignalType *) EeReadDataReq, EE_PROCESS_ID, EE_PRIMITIVE, EE_READ_DATA_req, 0); } } } } DeleteBuffer(Signal); }
static void PPNotSubscribedHandler(SignalType * Signal) { switch (Signal->Event) { case IWU_PRIMITIVE: { switch (Signal->SubEvent) { case OM_SUBS_CREATE_cfm: { OmSubsCreateCfmType *OmSubsCreateCfm = (OmSubsCreateCfmType *) Signal; if (OmSubsCreateCfm->NotAccepted) { PrintStatus(0, "Subscription failed"); if (baseFound) { startSubscribtion(); } } else { PrintStatus(0, "Subscription succeeded"); setSignalHandler(APPLICATION_PROCESS_ID_PP, PPAlreadySubscribedHandler, 0); } } break; case OM_SUBS_SELECT_cfm: { OmSubsSelectCfmType *OmSubsSelectCfm = (OmSubsSelectCfmType *) Signal; if (OmSubsSelectCfm->NotAccepted) { PrintStatus(0, "Subscription select failed!"); } else { if (baseFound) { startSubscribtion(); } else { OmSearchRfpiReqType *OmSearchRfpiReq; NewBuffer(sizeof(OmSearchRfpiReqType), (void **) &OmSearchRfpiReq); OmSearchRfpiReq->SignalHeader.SignalLength = sizeof(OmSearchRfpiReqType); OmSearchRfpiReq->SearchMode = SM_FindRfpis; InjectSignal((SignalType *) OmSearchRfpiReq, IWU_PROCESS_ID, IWU_PRIMITIVE, OM_SEARCH_RFPI_req, 0); } } } break; case OM_SEARCH_RFPI_ind: { char* readableAri; char* ptr; OmSearchRfpiIndType * OmSearchRfpiInd = (OmSearchRfpiIndType *) Signal; readableAri = getReadableARI(OmSearchRfpiInd->Rfpi); ptr = StringPrint(StatusString, "FP: ["); ptr = StringPrint(ptr, readableAri); ptr = StringPrint(ptr, "]"); PrintStatus(0, StatusString); mem_free(readableAri); if (isKT4585FP(OmSearchRfpiInd->Rfpi)) { OmSearchRfpiReqType *OmSearchRfpiReq; OmSubsSelectReqType *OmSubsSelectReq; PrintStatus(0, "Found KDAM FP"); NewBuffer(sizeof(OmSearchRfpiReqType), (void **) &OmSearchRfpiReq); OmSearchRfpiReq->SignalHeader.SignalLength = sizeof(OmSearchRfpiReqType); OmSearchRfpiReq->SearchMode = SM_Passiv; InjectSignal((SignalType *) OmSearchRfpiReq, IWU_PROCESS_ID, IWU_PRIMITIVE, OM_SEARCH_RFPI_req, 0); NewBuffer(sizeof(OmSubsSelectReqType), (void **) &OmSubsSelectReq); OmSubsSelectReq->SignalHeader.SignalLength = sizeof(OmSubsSelectReqType); OmSubsSelectReq->SubsNo = 0; InjectSignal((SignalType *) OmSubsSelectReq, IWU_PROCESS_ID, IWU_PRIMITIVE, OM_SUBS_SELECT_req, 0); memcpy(Rfpi, OmSearchRfpiInd->Rfpi, MaxAriRpnOctets); baseFound = 1; } } } break; } } DeleteBuffer(Signal); }