InternalSensors::InternalSensors(JNIEnv* env, jobject gps_obj, jobject sensors_obj) : obj_InternalGPS_(env, gps_obj), obj_NonGPSSensors_(env, sensors_obj) { // Retrieve method IDs from the InternalGPS object. Java::Class gps_cls(env, env->GetObjectClass(gps_obj)); mid_gps_setLocationProvider_ = env->GetMethodID(gps_cls, "setLocationProvider", "(Ljava/lang/String;)V"); // Retrieve method IDs from the NonGPSSensors object. Java::Class sensors_cls(env, env->GetObjectClass(sensors_obj)); mid_sensors_subscribeToSensor_ = env->GetMethodID(sensors_cls, "subscribeToSensor", "(I)Z"); mid_sensors_cancelSensorSubscription_ = env->GetMethodID(sensors_cls, "cancelSensorSubscription", "(I)Z"); mid_sensors_subscribedToSensor_ = env->GetMethodID(sensors_cls, "subscribedToSensor", "(I)Z"); mid_sensors_cancelAllSensorSubscriptions_ = env->GetMethodID(sensors_cls, "cancelAllSensorSubscriptions", "()V"); assert(mid_sensors_subscribeToSensor_ != NULL); assert(mid_sensors_cancelSensorSubscription_ != NULL); assert(mid_sensors_subscribedToSensor_ != NULL); assert(mid_sensors_cancelAllSensorSubscriptions_ != NULL); // Import the list of subscribable sensors from the NonGPSSensors object. getSubscribableSensors(env, sensors_obj); }
InternalSensors::InternalSensors(JNIEnv* env, jobject gps_obj, jobject sensors_obj) : obj_InternalGPS_(env, gps_obj), obj_NonGPSSensors_(env, sensors_obj) { // Import the list of subscribable sensors from the NonGPSSensors object. getSubscribableSensors(env, sensors_obj); }