×
Namespaces

Variants
Actions
(Difference between revisions)

WISE Thread Interface

From Nokia Developer Wiki
Jump to: navigation, search
vvsnaresh (Talk | contribs)
(categories added)
hamishwillee (Talk | contribs)
m (Hamishwillee - Fix categories)
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Description ==
+
[[Category:Bluetooth]][[Category:Maemo]][[Category:Symbian]][[Category:Symbian C++]][[Category:Porting]]
 +
{{ArticleMetaData
 +
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities=<!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|id= <!-- Article Id (Knowledge base articles only) -->
 +
|language=<!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|review-by=<!-- After re-review: [[User:username]] -->
 +
|review-timestamp=<!-- After re-review: YYYYMMDD -->
 +
|update-by=<!-- After significant update: [[User:username]]-->
 +
|update-timestamp=<!-- After significant update: YYYYMMDD -->
 +
|creationdate=20080617
 +
|author=[[User:Ebra]]
 +
}}
  
 +
== Description ==
  
 
== Maemo Platform ==
 
== Maemo Platform ==
Line 101: Line 122:
 
* [[WISE Syncronization Logic ]]
 
* [[WISE Syncronization Logic ]]
 
* [[WISE Protocol]]
 
* [[WISE Protocol]]
 
[[Category:WLAN]][[Category:Maemo]][[Category:S60]]
 

Revision as of 06:02, 2 May 2012

Article Metadata
Article
Created: ebra (17 Jun 2008)
Last edited: hamishwillee (02 May 2012)

Contents

Description

Maemo Platform

void* syncronize_client_thread(void* ptr);
void callback_syncronize_client(GtkAction* action,gpointer data)
{
pthread_t thread1,thread2;
MainView *view = get_mainview((void*)data);
if ( view->active ) show_note(view,"Note","Already running");
else if ( pthread_create(&thread1,NULL,syncronize_client_thread,(void*)view)==0 )
pthread_create(&thread2,NULL,update_screen_thread,(void*)view);
}
void* syncronize_client_thread(void* ptr)
{
MainView *view = get_mainview(ptr);
wise_engine* engine = create_engine(view->options);
view->active = TRUE;
if ( engine!=NULL )
{
syncronize_client(engine,view->logger);
log_result(engine,view->logger);
delete_engine(engine);
}
view->active = FALSE;
return NULL;
}

S60 Platform

TInt ThreadEntry(TAny* aPtr);
void CWISE_TESTAppView::RunEngineL(TInt aSyncType)
{
if ( iThread.ExitType()!=EExitPending ) iThread.Close();
 
iLogger->SetState(aSyncType);
User::LeaveIfError(iThread.Create(_L("WISEThread"),ThreadEntry,0x5000,
0x1000,0x1000000,iLogger));
 
iThread.Resume();
}
TInt ThreadFunction(TAny* aPtr)
{
CWISEEngine* engine = (CWISEEngine*)aPtr;
TInt state = engine->Logger().GetState();
if ( state < 2 )
{
if ( state==0 ) engine->SyncronizeClientL();
else engine->SyncronizeServerL();
engine->Logger().SetState(2);
}
else if ( state==3 )
{
engine->Logger().Flush();
CActiveScheduler::Stop();
}
return 0;
}
TInt ThreadEntry(TAny* aPtr)
{
CTrapCleanup* cleanupStack = CTrapCleanup::New();
if ( cleanupStack )
{
TRAPD( err,
CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
CleanupStack::PushL( scheduler );
CActiveScheduler::Install( scheduler );
 
CWISEEngine* eng = CWISEEngine::NewLC(*((CWISELogger*)aPtr));
 
CPeriodic* periodic = CPeriodic::NewL(CActive::EPriorityLow);
CleanupStack::PushL(periodic);
periodic->Start(1000, 1000000, TCallBack(ThreadFunction, eng));
 
CActiveScheduler::Start();
CleanupStack::PopAndDestroy(3);
);
delete cleanupStack;
cleanupStack = NULL;
}
return KErrNone;
}

Links

88 page views in the last 30 days.
×