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

Diff of /navit/navit/android.c

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

Revision 51 Revision 52
41#include "track.h" 41#include "track.h"
42#include "file.h" 42#include "file.h"
43#include "roadprofile.h" 43#include "roadprofile.h"
44#include "navit_nls.h" 44#include "navit_nls.h"
45 45
46#include "coffeecatch.h"
47#include "coffeejni.h"
48
46// #include "layout.h" 49// #include "layout.h"
47 50
48JNIEnv *jnienv; 51JNIEnv *jnienv;
49jobject *android_activity; 52jobject *android_activity;
50jobject *main_map_bitmap; 53jobject *main_map_bitmap;
62jmethodID DrawMapPreview_text = NULL; 65jmethodID DrawMapPreview_text = NULL;
63jmethodID NavitGraphics_send_osd_values2 = NULL; 66jmethodID NavitGraphics_send_osd_values2 = NULL;
64jmethodID NavitGraphics_set_vehicle_values2 = NULL; 67jmethodID NavitGraphics_set_vehicle_values2 = NULL;
65jmethodID NavitGraphics_set_vehicle_values3 = NULL; 68jmethodID NavitGraphics_set_vehicle_values3 = NULL;
66jmethodID NavitGraphics_send_route_rect_to_java = NULL; 69jmethodID NavitGraphics_send_route_rect_to_java = NULL;
70jmethodID NavitGraphics_alter_missing_icon = NULL;
67 71
68struct attr attr; 72struct attr attr;
69 73
70 74
71 75
480 } 484 }
481 //DBG // dbg(0,"l meth %p\n", *ret); 485 //DBG // dbg(0,"l meth %p\n", *ret);
482 return 1; 486 return 1;
483} 487}
484 488
489// #include <signal.h>
490Java_com_zoffcc_applications_zanavi_Navit_AppCrashC__XX_real(JNIEnv* env, jobject thiz) __attribute__((optimize("-O0")));
491Java_com_zoffcc_applications_zanavi_Navit_AppCrashC__XX_real(JNIEnv* env, jobject thiz) __attribute__((optimize("O0")));
492Java_com_zoffcc_applications_zanavi_Navit_AppCrashC__XX_real(JNIEnv* env, jobject thiz)
493{
494 send_alert_to_java(99, "app_crash_C:003");
495
496 int i = 3;
497 i = (1 / 0);
498
499 char* name = NULL;
500 name = (char*)0;
501 name = "ekrpowekrp";
502
503 int *pi;
504 int c;
505 pi = NULL;
506 c = *pi;
507
508 int *x = NULL;
509 int y = *x;
510 y = y + 1;
511
512 *(long*)0 = 0xDEADBEEF;
513
514 send_alert_to_java(99, "app_crash_C:004");
515}
516
517JNIEXPORT void JNICALL
518Java_com_zoffcc_applications_zanavi_Navit_AppCrashC(JNIEnv* env, jobject thiz)
519{
520 // dbg(0,"app_crash_C:001\n");
521 send_alert_to_java(99, "app_crash_C:001");
522 COFFEE_TRY_JNI(env, Java_com_zoffcc_applications_zanavi_Navit_AppCrashC__XX_real(env, thiz));
523 send_alert_to_java(99, "app_crash_C:002");
524 // dbg(0,"app_crash_C:099\n");
525}
526
485 527
486JNIEXPORT void JNICALL 528JNIEXPORT void JNICALL
487Java_com_zoffcc_applications_zanavi_Navit_NavitMain(JNIEnv* env, jobject thiz, jobject activity, jobject lang, int version, jobject display_density_string, jobject n_datadir, jobject n_sharedir, jobject bitmap) 529Java_com_zoffcc_applications_zanavi_Navit_NavitMain(JNIEnv* env, jobject thiz, jobject activity, jobject lang, int version, jobject display_density_string, jobject n_datadir, jobject n_sharedir, jobject bitmap)
530{
531 COFFEE_TRY_JNI(env, Java_com_zoffcc_applications_zanavi_Navit_NavitMain__XX_real(env, thiz, activity, lang, version, display_density_string, n_datadir, n_sharedir, bitmap));
532}
533
534Java_com_zoffcc_applications_zanavi_Navit_NavitMain__XX_real(JNIEnv* env, jobject thiz, jobject activity, jobject lang, int version, jobject display_density_string, jobject n_datadir, jobject n_sharedir, jobject bitmap)
488{ 535{
489#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 536#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
490 dbg(0,"+#+:enter\n"); 537 dbg(0,"+#+:enter\n");
491#endif 538#endif
492 539
1017 1064
1018 //DBG // dbg(0, "enter %p %p %f %f %f\n", thiz, (void *) id, x, y, z); 1065 //DBG // dbg(0, "enter %p %p %f %f %f\n", thiz, (void *) id, x, y, z);
1019 callback_call_4((struct callback *) id, sensor, &x, &y, &z); 1066 callback_call_4((struct callback *) id, sensor, &x, &y, &z);
1020} 1067}
1021 1068
1022JNIEXPORT void JNICALL 1069
1070
1023Java_com_zoffcc_applications_zanavi_NavitVehicle_VehicleCallback(JNIEnv *env, jobject thiz, double lat, double lon, float speed, float direction, double height, float radius, long gpstime) 1071Java_com_zoffcc_applications_zanavi_NavitVehicle_VehicleCallback__XX_real(JNIEnv *env, jobject thiz, double lat, double lon, float speed, float direction, double height, float radius, long gpstime)
1024{ 1072{
1025#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 1073#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
1026 dbg(0,"+#+:enter\n"); 1074 dbg(0,"+#+:enter\n");
1027#endif 1075#endif
1028 1076
1053 1101
1054#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 1102#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
1055 dbg(0,"+#+:leave\n"); 1103 dbg(0,"+#+:leave\n");
1056#endif 1104#endif
1057} 1105}
1106
1107
1108JNIEXPORT void JNICALL
1109Java_com_zoffcc_applications_zanavi_NavitVehicle_VehicleCallback(JNIEnv *env, jobject thiz, double lat, double lon, float speed, float direction, double height, float radius, long gpstime)
1110{
1111 COFFEE_TRY_JNI(env, Java_com_zoffcc_applications_zanavi_NavitVehicle_VehicleCallback__XX_real(env, thiz, lat, lon, speed, direction, height, radius, gpstime));
1112}
1113
1114
1115
1058 1116
1059void android_return_search_result(struct jni_object *jni_o, char *str) 1117void android_return_search_result(struct jni_object *jni_o, char *str)
1060{ 1118{
1061#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 1119#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
1062 dbg(0,"+#+:enter\n"); 1120 dbg(0,"+#+:enter\n");
1112 (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, return_generic_int, id, i); 1170 (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, return_generic_int, id, i);
1113 // -works- (*jnienv2)->CallStaticObjectMethod(jnienv2, NavitGraphicsClass2, return_generic_int, id, i); 1171 // -works- (*jnienv2)->CallStaticObjectMethod(jnienv2, NavitGraphicsClass2, return_generic_int, id, i);
1114 //DBG // dbg(0,"xa2\n"); 1172 //DBG // dbg(0,"xa2\n");
1115} 1173}
1116 1174
1175
1176
1117JNIEXPORT void JNICALL 1177JNIEXPORT void JNICALL
1118Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackSearchResultList(JNIEnv* env, jobject thiz, int id, int partial, jobject str, jobject str_town, jobject str_hn, int search_flags, jobject search_country, jobject latlon, int radius) 1178Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackSearchResultList(JNIEnv* env, jobject thiz, int id, int partial, jobject str, jobject str_town, jobject str_hn, int search_flags, jobject search_country, jobject latlon, int radius)
1179{
1180 COFFEE_TRY_JNI(env, Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackSearchResultList__XX_real(env, thiz, id, partial, str, str_town, str_hn, search_flags, search_country, latlon, radius));
1181}
1182
1183
1184JNIEXPORT void JNICALL
1185Java_com_zoffcc_applications_zanavi_NavitGraphics_CallbackSearchResultList__XX_real(JNIEnv* env, jobject thiz, int id, int partial, jobject str, jobject str_town, jobject str_hn, int search_flags, jobject search_country, jobject latlon, int radius)
1119{ 1186{
1120#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT 1187#ifdef NAVIT_FUNC_CALLS_DEBUG_PRINT
1121 dbg(0,"+#+:enter\n"); 1188 dbg(0,"+#+:enter\n");
1122#endif 1189#endif
1123 1190
4169 } 4236 }
4170 4237
4171 (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_send_route_rect_to_java, x1, y1, x2, y2, order); 4238 (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_send_route_rect_to_java, x1, y1, x2, y2, order);
4172} 4239}
4173 4240
4241void send_alert_to_java(int id, const char *text)
4242{
4243 JNIEnv *jnienv2;
4244 jnienv2 = jni_getenv();
4245
4246 if (NavitGraphicsClass2 == NULL)
4247 {
4248 if (!android_find_class_global("com/zoffcc/applications/zanavi/NavitGraphics", &NavitGraphicsClass2))
4249 {
4250 NavitGraphicsClass2 = NULL;
4251 return;
4252 }
4253 }
4254
4255 if (NavitGraphics_alter_missing_icon == NULL)
4256 {
4257 if (!android_find_static_method(NavitGraphicsClass2, "send_alert_to_java", "(ILjava/lang/String;)V", &NavitGraphics_alter_missing_icon))
4258 {
4259 return;
4260 }
4261 }
4262
4263 jstring string1 = (*jnienv2)->NewStringUTF(jnienv2, text);
4264 (*jnienv2)->CallStaticVoidMethod(jnienv2, NavitGraphicsClass2, NavitGraphics_alter_missing_icon, id, string1);
4265 (*jnienv2)->DeleteLocalRef(jnienv2, string1);
4266}
4267

Legend:
Removed from v.51  
changed lines
  Added in v.52

   
Visit the ZANavi Wiki