/[zanavi_public1]/navit/navit/vehicle/android/vehicle_android.c
ZANavi

Diff of /navit/navit/vehicle/android/vehicle_android.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 33 Revision 34
179#endif 179#endif
180 180
181 return 1; 181 return 1;
182} 182}
183 183
184static void vehicle_android_update_location_direct(jobject location) 184static void vehicle_android_update_location_direct(double lat, double lon, float speed, float direction, double height, float radius, long gpstime)
185{ 185{
186#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 186#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
187 dbg(0,"+#+:enter\n"); 187 dbg(0,"+#+:enter\n");
188#endif 188#endif
189 189
194 time_t tnow; 194 time_t tnow;
195 struct tm *tm; 195 struct tm *tm;
196 196
197 struct vehicle_priv *v = priv_global_android; 197 struct vehicle_priv *v = priv_global_android;
198 198
199 JNIEnv *jnienv2; 199 // +++JNIEnv *jnienv2;
200 jnienv2 = jni_getenv(); 200 // +++jnienv2 = jni_getenv();
201 201
202 //dbg(0,"jnienv=%p\n", jnienv); 202 //dbg(0,"jnienv=%p\n", jnienv);
203 //dbg(0,"priv_global_android=%p\n", priv_global_android); 203 //dbg(0,"priv_global_android=%p\n", priv_global_android);
204 //dbg(0,"v=%p\n", v); 204 //dbg(0,"v=%p\n", v);
205 //dbg(0,"location=%p\n", location); 205 //dbg(0,"location=%p\n", location);
206 206
207 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!) 207 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!)
208 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!) 208 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!)
209 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!) 209 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!)
210 v->geo.lat = (*jnienv2)->CallDoubleMethod(jnienv2, location, v->Location_getLatitude); 210 v->geo.lat = lat;
211 v->geo.lng = (*jnienv2)->CallDoubleMethod(jnienv2, location, v->Location_getLongitude); 211 v->geo.lng = lon;
212 v->speed = (*jnienv2)->CallFloatMethod(jnienv2, location, v->Location_getSpeed) * 3.6; // convert from m/s -> km/h 212 v->speed = speed;
213 v->direction = (*jnienv2)->CallFloatMethod(jnienv2, location, v->Location_getBearing); 213 v->direction = direction;
214 v->height = (*jnienv2)->CallDoubleMethod(jnienv2, location, v->Location_getAltitude); 214 v->height = height;
215 v->radius = (*jnienv2)->CallFloatMethod(jnienv2, location, v->Location_getAccuracy); 215 v->radius = radius;
216 tnow = (*jnienv2)->CallLongMethod(jnienv2, location, v->Location_getTime) / 1000; 216 tnow = gpstime;
217 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!) 217 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!)
218 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!) 218 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!)
219 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!) 219 // this seems to slow and stupid, try to give those values directly (instead of calling those functions every time!!)
220
221 220
222 tm = gmtime(&tnow); 221 tm = gmtime(&tnow);
223 strftime(v->fixiso8601, sizeof(v->fixiso8601), "%Y-%m-%dT%TZ", tm); 222 strftime(v->fixiso8601, sizeof(v->fixiso8601), "%Y-%m-%dT%TZ", tm);
224 // //DBG dbg(0,"lat %f lon %f\n",v->geo.lat,v->geo.lng); 223 // //DBG dbg(0,"lat %f lon %f\n",v->geo.lat,v->geo.lng);
225 v->have_coords = 1; 224 v->have_coords = 1;
226 225
227 // remove globalref again 226 // remove globalref again
228 (*jnienv2)->DeleteGlobalRef(jnienv2, location); 227 //+++(*jnienv2)->DeleteGlobalRef(jnienv2, location);
229 228
230 // ***** calls: navit.c -> navit_vehicle_update 229 // ***** calls: navit.c -> navit_vehicle_update
231 // xxx stupid callback stuff -> remove me!! xxx 230 // xxx stupid callback stuff -> remove me!! xxx
232 callback_list_call_attr_0(v->cbl, attr_position_coord_geo); 231 callback_list_call_attr_0(v->cbl, attr_position_coord_geo);
233 232

Legend:
Removed from v.33  
changed lines
  Added in v.34

   
Visit the ZANavi Wiki