📄 baseutil.cpp
字号:
DATE jobject2DATE( JNIEnv *JniEnv, jobject jobjectDate ){// COleDateTime dt; jclass jclassDate = JniEnv->GetObjectClass( jobjectDate ); jmethodID getYearMethodId = JniEnv->GetMethodID( jclassDate, "getYear", "()I" ); jint year = JniEnv->CallIntMethod( jobjectDate, getYearMethodId ); jmethodID getMonthMethodId = JniEnv->GetMethodID( jclassDate, "getMonth", "()I" ); jint month = JniEnv->CallIntMethod( jobjectDate, getMonthMethodId ); jmethodID getDateMethodId = JniEnv->GetMethodID( jclassDate, "getDate", "()I" ); jint date = JniEnv->CallIntMethod( jobjectDate, getDateMethodId ); jmethodID getHoursMethodId = JniEnv->GetMethodID( jclassDate, "getHours", "()I" ); jint hours = JniEnv->CallIntMethod( jobjectDate, getHoursMethodId ); jmethodID getMinutesMethodId = JniEnv->GetMethodID( jclassDate, "getMinutes", "()I" ); jint minutes = JniEnv->CallIntMethod( jobjectDate, getMinutesMethodId ); jmethodID getSecondsMethodId = JniEnv->GetMethodID( jclassDate, "getSeconds", "()I" ); jint seconds = JniEnv->CallIntMethod( jobjectDate, getSecondsMethodId );// dt.SetDateTime(year, month+1, date, hours, minutes, seconds);// return dt.m_dt; DATE dt=20050528; return dt;}// ************* used by Event and Threshold ***************jobject Create_ClassObject( JNIEnv *JniEnv, ClassObject *pClass ){ jobject JObject = NULL; IntelMobileChar * psType = pClass->GetType(); printf("create classobject:%s\n",psType); if ( strcmp(psType, IntelMobileText("Processor")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/processor/ProcessorClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("Battery")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/battery/BatteryClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("DisplayAdapter")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/display/DisplayAdapterClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("LinkProtocoIntelMobileText(")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/LinkProtocolClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("Protocol802_3")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/Protocol802_3Class", pClass, false ); } else if ( strcmp(psType, IntelMobileText("Protocol802_11")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/Protocol802_11Class", pClass, false ); } else if ( strcmp(psType, IntelMobileText("NetworkAdapter")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/NetworkAdapterClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("WiredAdapter")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/WiredAdapterClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("RadioAdapter")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/RadioAdapterClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("Platform")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/platform/PlatformClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("Context")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/context/ContextClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("PhysicalDisk")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/storage/PhysicalDiskClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("LogicalDisk")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/storage/LogicalDiskClass", pClass, false ); } else if ( strcmp(psType, IntelMobileText("Memory")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/storage/MemoryClass", pClass, false ); } delete [] psType; return JObject;}jobject Create_InstanceObject( JNIEnv *JniEnv, InstanceObject *pInstance ){ jobject JObject = NULL; IntelMobileChar * psType = pInstance->GetType(); printf("create instanceobjcet%s\n",psType); if ( strcmp(psType, IntelMobileText("Processor")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/processor/ProcessorInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("Battery")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/battery/BatteryInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("DisplayAdapter")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/display/DisplayAdapterInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("LinkProtocoIntelMobileText(")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/LinkProtocolInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("Protocol802_3")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/Protocol802_3Instance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("Protocol802_11")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/Protocol802_11Instance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("NetworkAdapter")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/NetworkAdapterInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("WiredAdapter")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/WiredAdapterInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("RadioAdapter")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/network/RadioAdapterInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("Platform")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/platform/PlatformInstance", pInstance, false); } else if ( strcmp(psType, IntelMobileText("Context")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/context/ContextInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("Connectivity")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/context/ConnectivityInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("Storage")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/Context/StorageInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("Power")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/context/PowerInstance", pInstance, false); } else if ( strcmp(psType, IntelMobileText("Display")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/Context/DisplayInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("Bandwidth")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/context/BandwidthInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("PhysicalDisk")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/storage/PhysicalDiskInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("LogicalDisk")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/storage/LogicalDiskInstance", pInstance, false ); } else if ( strcmp(psType, IntelMobileText("Memory")) == 0 ) { JObject = Create_jobject( JniEnv, "com/intel/mobile/storage/MemoryInstance", pInstance, false ); } delete [] psType; return JObject;}jobject Create_Property( JNIEnv *JniEnv, Property *pProperty ){ //printf("i come create property\n"); InstanceObject * pInstance = const_cast<InstanceObject*>(pProperty->GetParent()); jobject jobjectParent = Create_InstanceObject( JniEnv, pInstance ); jobject JObject = NULL; IntelMobileChar * psType = pProperty->GetType(); if (::strcmp(psType, IntelMobileText("")) == 0) { delete[] psType; psType = pProperty->GetType(); } if ( strcmp(psType, IntelMobileText("BoolProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/BoolProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("ByteProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/ByteProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("IntProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/IntProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("UIntProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/UIntProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("Int64Property")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/Int64Property", pProperty ); } else if ( strcmp(psType, IntelMobileText("UInt64Property")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/UInt64Property", pProperty ); } else if ( strcmp(psType, IntelMobileText("FloatProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/FloatProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("StringProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/StringProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("DateTimeProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/DateTimeProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("BoolArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/BoolArrayProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("ByteArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/ByteArrayProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("IntArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/IntArrayProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("UIntArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/UIntArrayProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("Int64ArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/Int64ArrayProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("UInt64ArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/UInt64ArrayProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("FloatArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/FloatArrayProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("StringArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/StringArrayProperty", pProperty ); } else if ( strcmp(psType, IntelMobileText("DateTimeArrayProperty")) == 0 ) { JObject = Create_jobjectProperty( JniEnv, jobjectParent, "com/intel/mobile/base/DateTimeArrayProperty", pProperty ); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -