javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/os.cpp
changeset 47 f40128debb5d
parent 35 85266cc22c7f
child 48 e0d6e9bd3ca7
equal deleted inserted replaced
35:85266cc22c7f 47:f40128debb5d
 11465 //
 11465 //
 11466 // MobileDevice, Screen, Input
 11466 // MobileDevice, Screen, Input
 11467 //
 11467 //
 11468 
 11468 
 11469 JNIEXPORT jint JNICALL OS_NATIVE( MobileDevice_1new )
 11469 JNIEXPORT jint JNICALL OS_NATIVE( MobileDevice_1new )
       
 11470 #ifdef __SYMBIAN32__
       
 11471   (JNIEnv* aJniEnv, jclass)
       
 11472 #else
 11470   (JNIEnv*, jclass)
 11473   (JNIEnv*, jclass)
       
 11474 #endif
 11471     {
 11475     {
 11472     jint handle = 0;
 11476     jint handle = 0;
 11473 #ifdef __SYMBIAN32__
 11477 #ifdef __SYMBIAN32__
       
 11478     SWT_TRY
       
 11479         {
       
 11480         SWT_LOG_JNI_CALL();
 11474         handle =  swtApp->initializeMobileDevice();
 11481         handle =  swtApp->initializeMobileDevice();
       
 11482         }
       
 11483     SWT_CATCH
 11475 #endif
 11484 #endif
 11476     return handle;    
 11485     return handle;    
 11477     }
 11486     }
 11478 
 11487 
 11479 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1createFlipWatch )
 11488 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1createFlipWatch )
 11480 #ifdef __SYMBIAN32__
 11489 #ifdef __SYMBIAN32__
 11481   (JNIEnv*, jclass, jint aHandle)
 11490   (JNIEnv* aJniEnv, jclass, jint aHandle)
 11482 #else
 11491 #else
 11483 (JNIEnv*, jclass, jint)
 11492   (JNIEnv*, jclass, jint)
 11484 #endif
 11493 #endif
 11485     {
 11494     {
 11486 #ifdef __SYMBIAN32__
 11495 #ifdef __SYMBIAN32__
 11487     CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
 11496     SWT_TRY
 11488     mobileDevice->CreateFlipWatchL();
 11497         {
       
 11498         SWT_LOG_JNI_CALL();
       
 11499         SWT_LOG_DATA_1( "handle=%x", aHandle );
       
 11500         CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
       
 11501         mobileDevice->CreateFlipWatchL();
       
 11502         }
       
 11503     SWT_CATCH
 11489 #endif
 11504 #endif
 11490     }
 11505     }
       
 11506     
 11491 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1destroy )
 11507 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1destroy )
 11492 #ifdef __SYMBIAN32__
 11508 #ifdef __SYMBIAN32__
 11493   (JNIEnv*, jclass, jint aHandle)
 11509   (JNIEnv* aJniEnv, jclass, jint /*aHandle*/)
 11494 #else
 11510 #else
 11495 (JNIEnv*, jclass, jint)
 11511   (JNIEnv*, jclass, jint)
 11496 #endif
 11512 #endif
 11497     {
 11513     {
 11498 #ifdef __SYMBIAN32__
 11514 #ifdef __SYMBIAN32__
 11499     swtApp->destroyMobileDevice();
 11515     SWT_TRY
       
 11516         {
       
 11517         SWT_LOG_JNI_CALL();
       
 11518         SWT_LOG_DATA_1( "handle=%x", aHandle );
       
 11519         swtApp->destroyMobileDevice();
       
 11520         }
       
 11521     SWT_CATCH
 11500 #endif
 11522 #endif
 11501     }
 11523     }
 11502 
 11524 
 11503 JNIEXPORT jint JNICALL OS_NATIVE( MobileDevice_1getUserInactivityTime )
 11525 JNIEXPORT jint JNICALL OS_NATIVE( MobileDevice_1getUserInactivityTime )
 11504 #ifdef __SYMBIAN32__
 11526 #ifdef __SYMBIAN32__
 11505   (JNIEnv*, jclass, jint aHandle)
 11527   (JNIEnv* aJniEnv, jclass, jint aHandle)
 11506 #else
 11528 #else
 11507 (JNIEnv*, jclass, jint)
 11529   (JNIEnv*, jclass, jint)
 11508 #endif
 11530 #endif
 11509     {
 11531     {
 11510     jint time=0;
 11532     jint time=0;
 11511 #ifdef __SYMBIAN32__
 11533 #ifdef __SYMBIAN32__
 11512     CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
 11534     SWT_TRY
 11513     time = mobileDevice->GetUserInactivityTime();
 11535         {
       
 11536         SWT_LOG_JNI_CALL();
       
 11537         SWT_LOG_DATA_1( "handle=%x", aHandle );
       
 11538         CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
       
 11539         time = mobileDevice->GetUserInactivityTime();
       
 11540         }
       
 11541     SWT_CATCH
 11514 #endif
 11542 #endif
 11515     return time;
 11543     return time;
 11516     }
 11544     }
 11517 
 11545 
 11518 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1resetUserInactivityTime )
 11546 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1resetUserInactivityTime )
 11519 #ifdef __SYMBIAN32__
 11547 #ifdef __SYMBIAN32__
 11520   (JNIEnv*, jclass, jint aHandle)
 11548   (JNIEnv* aJniEnv, jclass, jint aHandle)
 11521 #else
 11549 #else
 11522 (JNIEnv*, jclass, jint)
 11550   (JNIEnv*, jclass, jint)
 11523 #endif
 11551 #endif
 11524     {
 11552     {
 11525 #ifdef __SYMBIAN32__
 11553 #ifdef __SYMBIAN32__
 11526     CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
 11554     SWT_TRY
 11527     mobileDevice->ResetUserInactivityTime();
 11555         {
       
 11556         SWT_LOG_JNI_CALL();
       
 11557         SWT_LOG_DATA_1( "handle=%x", aHandle );
       
 11558         CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
       
 11559         mobileDevice->ResetUserInactivityTime();
       
 11560         }
       
 11561     SWT_CATCH
 11528 #endif
 11562 #endif
 11529     }
 11563     }
 11530 
 11564 
 11531 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1setLight )
 11565 JNIEXPORT void JNICALL OS_NATIVE( MobileDevice_1setLight )
 11532 #ifdef __SYMBIAN32__
 11566 #ifdef __SYMBIAN32__
 11533   (JNIEnv*, jclass, jint aHandle, jint aDuration)
 11567   (JNIEnv* aJniEnv, jclass, jint aHandle, jint aDuration)
 11534 #else
 11568 #else
 11535 (JNIEnv*, jclass, jint, jint)
 11569   (JNIEnv*, jclass, jint, jint)
 11536 #endif
 11570 #endif
 11537     {
 11571     {
 11538 #ifdef __SYMBIAN32__
 11572 #ifdef __SYMBIAN32__
 11539     CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
 11573     SWT_TRY
 11540     mobileDevice->SetLights(static_cast<TInt>(aDuration));
 11574         {
       
 11575         SWT_LOG_JNI_CALL();
       
 11576         SWT_LOG_DATA_2( "handle=%x duration=%x", aHandle, aDuration );
       
 11577         CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
       
 11578         mobileDevice->SetLights(static_cast<TInt>(aDuration));
       
 11579         }
       
 11580     SWT_CATCH
 11541 #endif
 11581 #endif
 11542     }
 11582     }
 11543 
 11583 
 11544 JNIEXPORT jboolean JNICALL OS_NATIVE( MobileDevice_1flashLights )
 11584 JNIEXPORT jboolean JNICALL OS_NATIVE( MobileDevice_1flashLights )
 11545 #ifdef __SYMBIAN32__
 11585 #ifdef __SYMBIAN32__
 11546   (JNIEnv *, jclass, jint aHandle, jint aDuration)
 11586   (JNIEnv* aJniEnv, jclass, jint aHandle, jint aDuration)
 11547 #else
 11587 #else
 11548 (JNIEnv*, jclass, jint, jint)
 11588   (JNIEnv*, jclass, jint, jint)
 11549 #endif
 11589 #endif
 11550     {
 11590     {
 11551     jboolean flashLights = JNI_FALSE;
 11591     jboolean flashLights = JNI_FALSE;
 11552 #ifdef __SYMBIAN32__
 11592 #ifdef __SYMBIAN32__
 11553     CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
 11593     SWT_TRY
 11554     TRAP_IGNORE(flashLights = mobileDevice->FlashBacklightL(static_cast<TInt>(aDuration)));
 11594         {
       
 11595         SWT_LOG_JNI_CALL();
       
 11596         SWT_LOG_DATA_2( "handle=%x duration=%x", aHandle, aDuration );
       
 11597         CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
       
 11598         TRAP_IGNORE(flashLights = mobileDevice->FlashBacklightL(static_cast<TInt>(aDuration)));
       
 11599         }
       
 11600     SWT_CATCH
 11555 #endif
 11601 #endif
 11556     return ( flashLights ? JNI_TRUE : JNI_FALSE );
 11602     return ( flashLights ? JNI_TRUE : JNI_FALSE );
 11557     }
 11603     }
 11558 
 11604 
 11559 JNIEXPORT jboolean JNICALL OS_NATIVE( MobileDevice_1vibration )
 11605 JNIEXPORT jboolean JNICALL OS_NATIVE( MobileDevice_1vibration )
 11560 #ifdef __SYMBIAN32__
 11606 #ifdef __SYMBIAN32__
 11561   (JNIEnv*, jclass, jint aHandle, jint aDuration)
 11607   (JNIEnv* aJniEnv, jclass, jint aHandle, jint aDuration)
 11562 #else
 11608 #else
 11563 (JNIEnv*, jclass, jint, jint)
 11609   (JNIEnv*, jclass, jint, jint)
 11564 #endif
 11610 #endif
 11565     {
 11611     {
 11566     jboolean vibraSupport = JNI_FALSE;
 11612     jboolean vibraSupport = JNI_FALSE;
 11567 #ifdef __SYMBIAN32__
 11613 #ifdef __SYMBIAN32__
 11568     CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
 11614     SWT_TRY
 11569     vibraSupport = mobileDevice->Vibrate((TTimeIntervalMicroSeconds32)static_cast<TInt>(aDuration));
 11615         {
       
 11616         SWT_LOG_JNI_CALL();
       
 11617         SWT_LOG_DATA_2( "handle=%x duration=%x", aHandle, aDuration );
       
 11618         CSwtMobileDevice* mobileDevice =  reinterpret_cast<CSwtMobileDevice*>(aHandle);
       
 11619         vibraSupport = mobileDevice->Vibrate((TTimeIntervalMicroSeconds32)static_cast<TInt>(aDuration));
       
 11620         }
       
 11621     SWT_CATCH
 11570 #endif
 11622 #endif
 11571     return ( vibraSupport ? JNI_TRUE : JNI_FALSE );
 11623     return ( vibraSupport ? JNI_TRUE : JNI_FALSE );
 11572     }
 11624     }
 11573 
 11625 
 11574 JNIEXPORT jint JNICALL OS_NATIVE( getScreenDeviceNumber )
 11626 JNIEXPORT jint JNICALL OS_NATIVE( getScreenDeviceNumber )
       
 11627 #ifdef __SYMBIAN32__
       
 11628   (JNIEnv* aJniEnv, jclass)
       
 11629 #else
 11575   (JNIEnv*, jclass)
 11630   (JNIEnv*, jclass)
       
 11631 #endif
 11576     {
 11632     {
 11577     jint screenNumber = -1;
 11633     jint screenNumber = -1;
 11578 #ifdef __SYMBIAN32__
 11634 #ifdef __SYMBIAN32__
       
 11635     SWT_TRY
       
 11636         {
       
 11637         SWT_LOG_JNI_CALL();
 11579         screenNumber = SymbianUtils::GetScreenDeviceNumber();
 11638         screenNumber = SymbianUtils::GetScreenDeviceNumber();
       
 11639         }
       
 11640     SWT_CATCH
 11580 #endif
 11641 #endif
 11581     return screenNumber;    
 11642     return screenNumber;    
 11582     }
 11643     }
 11583 
 11644 
 11584 JNIEXPORT jint JNICALL OS_NATIVE( getColorDepth )
 11645 JNIEXPORT jint JNICALL OS_NATIVE( getColorDepth )
       
 11646 #ifdef __SYMBIAN32__
       
 11647   (JNIEnv* aJniEnv, jclass)
       
 11648 #else
 11585   (JNIEnv*, jclass)
 11649   (JNIEnv*, jclass)
       
 11650 #endif
 11586     {
 11651     {
 11587     jint colorDepth = 24;
 11652     jint colorDepth = 24;
 11588 #ifdef __SYMBIAN32__
 11653 #ifdef __SYMBIAN32__
 11589     colorDepth = SymbianUtils::GetColorDepth();
 11654     SWT_TRY
       
 11655         {
       
 11656         SWT_LOG_JNI_CALL();
       
 11657         colorDepth = SymbianUtils::GetColorDepth();
       
 11658         }
       
 11659     SWT_CATCH
 11590 #endif
 11660 #endif
 11591     return colorDepth;    
 11661     return colorDepth;    
 11592     }
 11662     }
 11593 
 11663 
 11594 JNIEXPORT jint JNICALL OS_NATIVE( getHwInputs )
 11664 JNIEXPORT jint JNICALL OS_NATIVE( getHwInputs )
       
 11665 #ifdef __SYMBIAN32__
       
 11666   (JNIEnv* aJniEnv, jclass)
       
 11667 #else
 11595   (JNIEnv*, jclass)
 11668   (JNIEnv*, jclass)
       
 11669 #endif
 11596     {
 11670     {
 11597     jint hwInputs = 0;
 11671     jint hwInputs = 0;
 11598 #ifdef __SYMBIAN32__
 11672 #ifdef __SYMBIAN32__
       
 11673     SWT_TRY
       
 11674         {
       
 11675         SWT_LOG_JNI_CALL();
 11599         hwInputs = SymbianUtils::GetHwInputs();
 11676         hwInputs = SymbianUtils::GetHwInputs();
       
 11677         }
       
 11678     SWT_CATCH
 11600 #endif
 11679 #endif
 11601     return hwInputs;    
 11680     return hwInputs;    
 11602     }
 11681     }
 11603 
 11682 
 11604 //
 11683 //