📄 baseutil.cpp
字号:
else if ( strcmp(psType, IntelMobileText("HTStatusTypeProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/HTStatusTypeProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("CacheTypeValueProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/CacheTypeValueProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("ConditionTypeProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/ConditionTypeProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("OrientationEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/OrientationEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("ScreenStateEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/ScreenStateEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("SourceTypeProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/SourceTypeProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("ProtocolStatusTypeProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/ProtocolStatusTypeProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("ProtocolModeTypeProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/ProtocolModeTypeProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("ProtocolPowerTypeProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/ProtocolPowerTypeProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("NetworkAdapterTypeProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/NetworkAdapterTypeProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("NetConnectionStatusTypeProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/NetConnectionStatusTypeProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("InterfaceEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/InterfaceEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("MediaEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/MediaEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("AccessEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/AccessEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("FormatEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/FormatEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("LocationEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/LocationEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("ConnectionStateEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/ConnectionStateEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("HciVersionEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/HciVersionEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("LmpVersionEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/LmpVersionEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("MajorDeviceClassEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/MajorDeviceClassEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("RadioStateEnumProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/RadioStateEnumProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("ServiceClassEnumArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/ServiceClassEnumArrayProperty", pProperty ); } //===============================================================#define IF_NEW_PROPERTY(propertyname,pathname) \ else if ( strcmp(psType, IntelMobileText("#propertyname")) == 0 ) \ { \ JObject = Create_jobjectProperty( JniEnv, jobjectParent, "#pathname", pProperty ); \ } IF_NEW_PROPERTY(AdapterLinkEnumProperty ,com/intel/mobile/network/AdapterLinkEnumProperty ) IF_NEW_PROPERTY(ConnectionStateEnumProperty ,com/intel/mobile/network/ConnectionStateEnumProperty ) IF_NEW_PROPERTY(ProtocolStateEnumProperty ,com/intel/mobile/network/ProtocolStateEnumProperty ) IF_NEW_PROPERTY(OperatingModeEnumProperty ,com/intel/mobile/network/OperatingModeEnumProperty ) IF_NEW_PROPERTY(WlanPowerModeEnumProperty ,com/intel/mobile/network/WlanPowerModeEnumProperty ) IF_NEW_PROPERTY(CardTypeEnumProperty ,com/intel/mobile/network/CardTypeEnumProperty ) IF_NEW_PROPERTY(HardwareRadioStateEnumProperty ,com/intel/mobile/network/HardwareRadioStateEnumProperty ) IF_NEW_PROPERTY(SoftwareRadioStateEnumProperty ,com/intel/mobile/network/SoftwareRadioStateEnumProperty ) IF_NEW_PROPERTY(WlanBandEnumProperty ,com/intel/mobile/network/WlanBandEnumProperty ) IF_NEW_PROPERTY(AuthenticationModeEnumProperty ,com/intel/mobile/network/AuthenticationModeEnumProperty ) IF_NEW_PROPERTY(WlanEncryptionModeEnumProperty ,com/intel/mobile/network/WlanEncryptionModeEnumProperty ) IF_NEW_PROPERTY(AssociationStateEnumProperty ,com/intel/mobile/network/AssociationStateEnumProperty ) IF_NEW_PROPERTY(SecurityModeEnumProperty ,com/intel/mobile/network/SecurityModeEnumProperty ) IF_NEW_PROPERTY(QosEnumProperty ,com/intel/mobile/network/QosEnumProperty ) IF_NEW_PROPERTY(WwanEncryptionModeEnumProperty ,com/intel/mobile/network/WwanEncryptionModeEnumProperty ) IF_NEW_PROPERTY(WwanPowerModeEnumProperty ,com/intel/mobile/network/WwanPowerModeEnumProperty ) IF_NEW_PROPERTY(ChannelStateEnumProperty ,com/intel/mobile/network/ChannelStateEnumProperty ) IF_NEW_PROPERTY(RoamingStateEnumProperty ,com/intel/mobile/network/RoamingStateEnumProperty ) IF_NEW_PROPERTY(ServiceIndicationEnumProperty ,com/intel/mobile/network/ServiceIndicationEnumProperty ) IF_NEW_PROPERTY(CallStateEnumProperty ,com/intel/mobile/network/CallStateEnumProperty ) IF_NEW_PROPERTY(WwanBandEnumProperty ,com/intel/mobile/network/WwanBandEnumProperty ) IF_NEW_PROPERTY(CallCategoryEnumProperty ,com/intel/mobile/network/CallCategoryEnumProperty ) IF_NEW_PROPERTY(LinkQualityEnumProperty ,com/intel/mobile/network/LinkQualityEnumProperty ) IF_NEW_PROPERTY(GprsClassEnumProperty ,com/intel/mobile/network/GprsClassEnumProperty ) IF_NEW_PROPERTY(AnswerStateEnumProperty ,com/intel/mobile/network/AnswerStateEnumProperty ) IF_NEW_PROPERTY(ProtocolRevisionEnumProperty ,com/intel/mobile/network/ProtocolRevisionEnumProperty ) IF_NEW_PROPERTY(ModulationTypeEnumProperty ,com/intel/mobile/network/ModulationTypeEnumProperty ) IF_NEW_PROPERTY(BandEnumArrayProperty ,com/intel/mobile/network/BandEnumArrayProperty ) IF_NEW_PROPERTY(ModulationTypeEnumArrayProperty ,com/intel/mobile/network/ModulationTypeEnumArrayProperty ) IF_NEW_PROPERTY(SecurityModeEnumArrayProperty ,com/intel/mobile/network/SecurityModeEnumArrayProperty ) IF_NEW_PROPERTY(WwanEncryptionModeEnumArrayProperty ,com/intel/mobile/network/WwanEncryptionModeEnumArrayProperty ) IF_NEW_PROPERTY(WlanEncryptionModeEnumArrayProperty ,com/intel/mobile/network/WlanEncryptionModeEnumArrayProperty ) else { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/DummyProperty", pProperty ); } delete [] psType; return JObject;}jobject Create_Threshold( JNIEnv *JniEnv, Threshold *pThreshold ){ jobject JObject = NULL; IntelMobileChar * psType = pThreshold->GetType(); if ( strcmp(psType, IntelMobileText("ByteCounterThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/ByteCounterThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("IntCounterThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/IntCounterThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("UIntCounterThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/UIntCounterThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("Int64CounterThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/Int64CounterThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("UInt64CounterThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/UInt64CounterThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("DateCounterThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/DateCounterThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("ByteGaugeThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/ByteGaugeThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("IntGaugeThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/IntGaugeThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("UIntGaugeThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/UIntGaugeThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("Int64GaugeThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/Int64GaugeThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("UInt64GaugeThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/UInt64GaugeThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("DateGaugeThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/DateGaugeThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("FloatGaugeThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/FloatGaugeThreshold", pThreshold, false ); } else if ( strcmp(psType, IntelMobileText("StringValueThreshold")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/StringValueThreshold", pThreshold, false ); } else { JObject = Create_jobject( JniEnv, "com/intel/mobile/threshold/DummyThreshold", pThreshold, false ); } delete [] psType; return JObject;}// *********************************************************void ThrowException( JNIEnv *JniEnv, IntelMobileException Ex ){ //printf("i will throwexception\n"); const IntelMobileChar * psMessage = Ex.GetGeneralMessage(); //if ( strcmp(psMessage, IntelMobileText("dummy_return")) == 0 ) return; const IntelMobileChar * psSource = Ex.GetSource(); const IntelMobileChar * psSite = Ex.GetTargetSite(); const IntelMobileChar * psErrorCode = Ex.GetErrorCode(); const IntelMobileChar * psErrorInfo = Ex.GetDetailErrorInfo(); char * ExName; if ( Ex.GetExceptionType() == 1 ) ExName = "com/intel/mobile/base/InvalidOperationException"; else if ( Ex.GetExceptionType() == 2 ) ExName = "com/intel/mobile/base/InvalidInterfaceException"; else ExName = "com/intel/mobile/base/IntelMobileException"; ThrowException( JniEnv, ExName, psMessage, psSource, psSite, psErrorCode, psErrorInfo );}void ThrowUnknownException( JNIEnv *JniEnv, const IntelMobileChar *psSource, const IntelMobileChar *psSite ){ ThrowException( JniEnv, "com/intel/mobile/base/IntelMobileException", IntelMobileText("Unknown Exception"), psSource, psSite, IntelMobileText("0" ));}void ThrowException( JNIEnv *JniEnv, const char *ExName, const IntelMobileChar *psMessage, const IntelMobileChar *psSource, const IntelMobileChar *psSite, const IntelMobileChar *psErrorCode, const IntelMobileChar *psErrorInfo ){ jstring sMessage = BSTR2jstring( JniEnv, psMessage );//printf("psMessage:%s\n",psMessage); jstring sSource = BSTR2jstring( JniEnv, psSource );//printf("sSource%s\n",psSource); jstring sSite = BSTR2jstring( JniEnv, psSite );//printf("sSite%s\n",psSite); jstring sErrorCode = BSTR2jstring( JniEnv, psErrorCode );//printf("psErrorCode%s\n",psErrorCode); jstring sErrorInfo; if ( psErrorInfo != NULL ) sErrorInfo = BSTR2jstring( JniEnv, psErrorInfo ); else sErrorInfo = BSTR2jstring( JniEnv, IntelMobileException::GetDetailErrorInfo( psErrorCode ) ); jclass jclassException = JniEnv->FindClass( ExName ); jmethodID MethodId = JniEnv->GetMethodID( jclassException, "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V" ); try { jobject jobjectException = JniEnv->NewObject( jclassException, MethodId, sMessage, sSource, sSite, sErrorCode, sErrorInfo ); JniEnv->Throw( (jthrowable)jobjectException ); } catch (...) { // This is not the first java exception, do nothing to ignore it. }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -