Check-in [d7cacd9d73]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:first draft implementation of "borg sendsms" to send SMS text messages
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d7cacd9d731cdccdea2f2f8e39f9e0fbe5a93b83
User & Date: chw 2015-11-18 19:21:35
Context
2015-11-19
07:49
minor changes in Bluetooth state/scan mode indications check-in: 0cd22763e4 user: chw tags: trunk
2015-11-18
19:21
first draft implementation of "borg sendsms" to send SMS text messages check-in: d7cacd9d73 user: chw tags: trunk
10:18
use zlib when available in pdf output of tkpath pimage items check-in: f5c23d3c55 user: chw tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to AndroidManifest.xml.

115
116
117
118
119
120
121



122
123
124
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_SETTINGS" />
  <uses-permission android:name="android.permission.WRITE_SMS" />
  <uses-permission android:name="android.permission.CAMERA" />
  <!-- Uncomment this for "borg phoneinfo" and "<<Phone*>>" virtual events
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  -->



  <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
  <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
</manifest>







>
>
>



115
116
117
118
119
120
121
122
123
124
125
126
127
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_SETTINGS" />
  <uses-permission android:name="android.permission.WRITE_SMS" />
  <uses-permission android:name="android.permission.CAMERA" />
  <!-- Uncomment this for "borg phoneinfo" and "<<Phone*>>" virtual events
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  -->
  <!-- Uncomment this for "borg sendsms"
    <uses-permission android:name="android.permission.SEND_SMS" />
  -->
  <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
  <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
</manifest>

Changes to hellotcltk/AndroidManifest.xml.

61
62
63
64
65
66
67



68
69
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_SETTINGS" />
  <uses-permission android:name="android.permission.WRITE_SMS" />
  <uses-permission android:name="android.permission.CAMERA" />
  <!-- Uncomment this for "borg phoneinfo" and "<<Phone*>>" virtual events
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  -->



  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>







>
>
>


61
62
63
64
65
66
67
68
69
70
71
72
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_SETTINGS" />
  <uses-permission android:name="android.permission.WRITE_SMS" />
  <uses-permission android:name="android.permission.CAMERA" />
  <!-- Uncomment this for "borg phoneinfo" and "<<Phone*>>" virtual events
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  -->
  <!-- Uncomment this for "borg sendsms"
    <uses-permission android:name="android.permission.SEND_SMS" />
  -->
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>

Changes to hellotcltk/libs/tcltkapplib.jar.

cannot compute difference between binary files

Changes to jni/src/tkBorg.c.

77
78
79
80
81
82
83

84
85
86
87
88
89
90

static JavaVM *jvm;

/* Cached tk.tcl.wish.AndroWish static methods IDs */

static jmethodID M_AW_runActivityEx = NULL;
static jmethodID M_AW_handleBroadcastListener = NULL;

static jmethodID M_AW_speechRecognition = NULL;
static jmethodID M_AW_queryIntents = NULL;
static jmethodID M_AW_queryFeatures = NULL;
static jmethodID M_AW_packageInfo = NULL;
static jmethodID M_AW_providerInfo = NULL;
static jmethodID M_AW_vibrate = NULL;
static jmethodID M_AW_beep = NULL;







>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

static JavaVM *jvm;

/* Cached tk.tcl.wish.AndroWish static methods IDs */

static jmethodID M_AW_runActivityEx = NULL;
static jmethodID M_AW_handleBroadcastListener = NULL;
static jmethodID M_AW_sendSMS = NULL;
static jmethodID M_AW_speechRecognition = NULL;
static jmethodID M_AW_queryIntents = NULL;
static jmethodID M_AW_queryFeatures = NULL;
static jmethodID M_AW_packageInfo = NULL;
static jmethodID M_AW_providerInfo = NULL;
static jmethodID M_AW_vibrate = NULL;
static jmethodID M_AW_beep = NULL;
151
152
153
154
155
156
157






158
159
160
161
162
163
164
	&M_AW_runActivityEx
    },
    {
	"handleBroadcastListener",
	"(ILjava/lang/String;)I",
	&M_AW_handleBroadcastListener
    },






    {
	"speechRecognition",
	"([Ljava/lang/String;[Ljava/lang/String;I)I",
	&M_AW_speechRecognition
    },
    {
	"queryIntents",







>
>
>
>
>
>







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	&M_AW_runActivityEx
    },
    {
	"handleBroadcastListener",
	"(ILjava/lang/String;)I",
	&M_AW_handleBroadcastListener
    },
    {
	"sendSMS",
	"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;"
	    "Ljava/lang/String;Ljava/lang/String;)I",
	&M_AW_sendSMS
    },
    {
	"speechRecognition",
	"([Ljava/lang/String;[Ljava/lang/String;I)I",
	&M_AW_speechRecognition
    },
    {
	"queryIntents",
1411
1412
1413
1414
1415
1416
1417




1418
1419
1420
1421
1422
1423
1424
    JNIEnv *env = GetJNIEnv();
    ThreadSpecificData *tsdPtr = GetTSD();
    Tcl_HashEntry *hPtr;
    Callback *cb;
    jstring jaction;
    int ret = -1, isNew;





    if (op < 0) {
	/* list */
	Tcl_MutexLock(&mutex);
	if (action == NULL) {
	    Tcl_HashSearch search;
	    Tcl_Obj *list = Tcl_NewListObj(0, NULL);








>
>
>
>







1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
    JNIEnv *env = GetJNIEnv();
    ThreadSpecificData *tsdPtr = GetTSD();
    Tcl_HashEntry *hPtr;
    Callback *cb;
    jstring jaction;
    int ret = -1, isNew;

    if (env == NULL) {
	Tcl_SetResult(interp, "no JNIEnv", TCL_STATIC);
	return TCL_ERROR;
    }
    if (op < 0) {
	/* list */
	Tcl_MutexLock(&mutex);
	if (action == NULL) {
	    Tcl_HashSearch search;
	    Tcl_Obj *list = Tcl_NewListObj(0, NULL);

1482
1483
1484
1485
1486
1487
1488


















































1489
1490
1491
1492
1493
1494
1495
	ret = (*env)->CallStaticIntMethod(env, jactivity,
					  M_AW_handleBroadcastListener,
					  op, jaction);
	Tcl_MutexUnlock(&mutex);
    }
    if (jaction != NULL) {
	(*env)->DeleteLocalRef(env, jaction);


















































    }
    Tcl_SetObjResult(interp, Tcl_NewIntObj(ret));
    return TCL_OK;
}

static int
SpeechRecognition(Tcl_Interp *interp, int op, int argc, const char **argv,







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
	ret = (*env)->CallStaticIntMethod(env, jactivity,
					  M_AW_handleBroadcastListener,
					  op, jaction);
	Tcl_MutexUnlock(&mutex);
    }
    if (jaction != NULL) {
	(*env)->DeleteLocalRef(env, jaction);
    }
    Tcl_SetObjResult(interp, Tcl_NewIntObj(ret));
    return TCL_OK;
}

static int
SendSMS(Tcl_Interp *interp, const char *phone, const char *msg,
	const char *actionSent, const char *actionDelivered,
	const char *smsc)
{
    JNIEnv *env = GetJNIEnv();
    int ret;
    jstring jphone = NULL, jmsg = NULL, jactS = NULL, jactD = NULL;
    jstring jsmsc = NULL;

    if (env == NULL) {
	Tcl_SetResult(interp, "no JNIEnv", TCL_STATIC);
	return TCL_ERROR;
    }
    if (phone[0] != '\0') {
	jphone = (*env)->NewStringUTF(env, phone);
    }
    if (msg[0] != '\0') {
	jmsg = (*env)->NewStringUTF(env, msg);
    }
    if ((actionSent != NULL) && (actionSent[0] != '\0')) {
	jactS = (*env)->NewStringUTF(env, actionSent);
    }
    if ((actionDelivered != NULL) && (actionDelivered[0] != '\0')) {
	jactD = (*env)->NewStringUTF(env, actionDelivered);
    }
    if ((smsc != NULL) && (smsc[0] != '\0')) {
	jsmsc = (*env)->NewStringUTF(env, smsc);
    }
    ret = (*env)->CallStaticIntMethod(env, jactivity, M_AW_sendSMS,
				      jphone, jmsg, jactS, jactD, jsmsc);
    if (jsmsc != NULL) {
	(*env)->DeleteLocalRef(env, jsmsc);
    }
    if (jactD != NULL) {
	(*env)->DeleteLocalRef(env, jactD);
    }
    if (jactS != NULL) {
	(*env)->DeleteLocalRef(env, jactS);
    }
    if (jmsg != NULL) {
	(*env)->DeleteLocalRef(env, jmsg);
    }
    if (jphone != NULL) {
	(*env)->DeleteLocalRef(env, jphone);
    }
    Tcl_SetObjResult(interp, Tcl_NewIntObj(ret));
    return TCL_OK;
}

static int
SpeechRecognition(Tcl_Interp *interp, int op, int argc, const char **argv,
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
#ifdef HAVE_EVENTFD
    long long one = 1;
#else
    int fd;
#endif
    char c[1], buffer[32];

    if (!cb->isIntent && !cb->isBroadcast) {
	sprintf(buffer, "%d", ret);
	Tcl_DStringAppendElement(&cb->cmd, buffer);
    }
    if (!cb->isSpeechRecognition) {
	str = NULL;
	if (action != NULL) {
	    str = (*env)->GetStringUTFChars(env, action, 0);







|







2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
#ifdef HAVE_EVENTFD
    long long one = 1;
#else
    int fd;
#endif
    char c[1], buffer[32];

    if (!cb->isIntent) {
	sprintf(buffer, "%d", ret);
	Tcl_DStringAppendElement(&cb->cmd, buffer);
    }
    if (!cb->isSpeechRecognition) {
	str = NULL;
	if (action != NULL) {
	    str = (*env)->GetStringUTFChars(env, action, 0);
2491
2492
2493
2494
2495
2496
2497

2498
2499
2500
2501
2502
2503
2504
			     cats, args);
    }
}

JNIEXPORT void JNICALL
Java_tk_tcl_wish_AndroWish_nativeBroadcastCallback(JNIEnv *env,
						jclass cls,

						jstring action,
						jstring uristr,
						jstring type,
						jobjectArray cats,
						jobjectArray args)
{
    Tcl_HashEntry *hPtr;







>







2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
			     cats, args);
    }
}

JNIEXPORT void JNICALL
Java_tk_tcl_wish_AndroWish_nativeBroadcastCallback(JNIEnv *env,
						jclass cls,
						jint ret,
						jstring action,
						jstring uristr,
						jstring type,
						jobjectArray cats,
						jobjectArray args)
{
    Tcl_HashEntry *hPtr;
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
	Tcl_DStringInit(&cb->cmd);
	Tcl_DStringAppend(&cb->cmd, Tcl_DStringValue(&cb0->cmd),
			  Tcl_DStringLength(&cb0->cmd));
    }
    Tcl_MutexUnlock(&mutex);
    (*env)->ReleaseStringUTFChars(env, action, str);
    if (cb != NULL) {
	MakeCallbackFromData(env, cb, -1, 0, action, uristr, type,
			     cats, args);
    }
}

static int
SimpleNativeTrigger(const char *name, int code)
{







|







2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
	Tcl_DStringInit(&cb->cmd);
	Tcl_DStringAppend(&cb->cmd, Tcl_DStringValue(&cb0->cmd),
			  Tcl_DStringLength(&cb0->cmd));
    }
    Tcl_MutexUnlock(&mutex);
    (*env)->ReleaseStringUTFChars(env, action, str);
    if (cb != NULL) {
	MakeCallbackFromData(env, cb, -1, ret, action, uristr, type,
			     cats, args);
    }
}

static int
SimpleNativeTrigger(const char *name, int code)
{
4539
4540
4541
4542
4543
4544
4545

4546
4547
4548
4549
4550
4551
4552
    JNIEnv *env = GetJNIEnv();
    jbyteArray jdata;
    jsize len;
    unsigned char *p;

    if (env == NULL) {
	Tcl_SetResult(interp, "no JNIEnv", TCL_STATIC);

    }
    if (start) {
	jboolean ret;

	ret = (*env)->CallStaticBooleanMethod(env, jactivity,
					      M_AW_cameraTakePicture);
	Tcl_SetObjResult(interp, Tcl_NewIntObj(ret == JNI_TRUE));







>







4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
    JNIEnv *env = GetJNIEnv();
    jbyteArray jdata;
    jsize len;
    unsigned char *p;

    if (env == NULL) {
	Tcl_SetResult(interp, "no JNIEnv", TCL_STATIC);
	return TCL_ERROR;
    }
    if (start) {
	jboolean ret;

	ret = (*env)->CallStaticBooleanMethod(env, jactivity,
					      M_AW_cameraTakePicture);
	Tcl_SetObjResult(interp, Tcl_NewIntObj(ret == JNI_TRUE));
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
	"content", "displaymetrics", "endspeak", "isspeaking",
	"keyboardinfo", "locale", "location", "log",
	"networkinfo",
	"notification", "onintent", "osbuildinfo",
	"packageinfo", "phoneinfo", "providerinfo",
	"queryactivities", "querybroadcastreceivers",
	"queryconsts", "queryfeatures", "queryservices",
	"screenorientation", "sensor", "shortcut", "speak",
	"speechrecognition", "spinner", "stopspeak",
	"systemproperties", "systemui", "tetherinfo", "toast",
	"trace", "usbdevices", "vibrate", "withdraw", NULL
    };
    enum borgCommands {
	BORG_activity, BORG_alarm, BORG_beep, BORG_bluetooth,
	BORG_brightness, BORG_broadcast, BORG_camera, BORG_cancel,
	BORG_content, BORG_displaymetrics, BORG_endspeak, BORG_isspeaking,
	BORG_keyboardinfo, BORG_locale, BORG_location, BORG_log,
	BORG_networkinfo,
	BORG_notification, BORG_onintent, BORG_osbuildinfo,
	BORG_packageinfo, BORG_phoneinfo, BORG_providerinfo,
	BORG_queryactivities, BORG_querybroadcastreceivers,
	BORG_queryconsts, BORG_queryfeatures, BORG_queryservices,
	BORG_screenorientation, BORG_sensor, BORG_shortcut, BORG_speak,
	BORG_speechrecognition, BORG_spinner, BORG_stopspeak,
	BORG_systemproperties, BORG_systemui, BORG_tetherinfo, BORG_toast,
	BORG_trace, BORG_usbdevices, BORG_vibrate, BORG_withdraw
    };

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "option data ?...?");
	return TCL_ERROR;







|
|













|
|







4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
	"content", "displaymetrics", "endspeak", "isspeaking",
	"keyboardinfo", "locale", "location", "log",
	"networkinfo",
	"notification", "onintent", "osbuildinfo",
	"packageinfo", "phoneinfo", "providerinfo",
	"queryactivities", "querybroadcastreceivers",
	"queryconsts", "queryfeatures", "queryservices",
	"screenorientation", "sendsms", "sensor", "shortcut",
	"speak", "speechrecognition", "spinner", "stopspeak",
	"systemproperties", "systemui", "tetherinfo", "toast",
	"trace", "usbdevices", "vibrate", "withdraw", NULL
    };
    enum borgCommands {
	BORG_activity, BORG_alarm, BORG_beep, BORG_bluetooth,
	BORG_brightness, BORG_broadcast, BORG_camera, BORG_cancel,
	BORG_content, BORG_displaymetrics, BORG_endspeak, BORG_isspeaking,
	BORG_keyboardinfo, BORG_locale, BORG_location, BORG_log,
	BORG_networkinfo,
	BORG_notification, BORG_onintent, BORG_osbuildinfo,
	BORG_packageinfo, BORG_phoneinfo, BORG_providerinfo,
	BORG_queryactivities, BORG_querybroadcastreceivers,
	BORG_queryconsts, BORG_queryfeatures, BORG_queryservices,
	BORG_screenorientation, BORG_sendsms, BORG_sensor, BORG_shortcut,
	BORG_speak, BORG_speechrecognition, BORG_spinner, BORG_stopspeak,
	BORG_systemproperties, BORG_systemui, BORG_tetherinfo, BORG_toast,
	BORG_trace, BORG_usbdevices, BORG_vibrate, BORG_withdraw
    };

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "option data ?...?");
	return TCL_ERROR;
4868
4869
4870
4871
4872
4873
4874












4875
4876
4877
4878
4879
4880
4881
	    }
	    break;
	}

	}
	return ret;
    }













    case BORG_speechrecognition: {
	int largc = 0;
	CONST char **largv = NULL;
	static CONST char *CONST speechCmds[] = {
	    "callback", "cancel", "intent", "start", "stop", NULL
	};







>
>
>
>
>
>
>
>
>
>
>
>







4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
	    }
	    break;
	}

	}
	return ret;
    }

    case BORG_sendsms: {
	if ((objc < 4) || (objc > 7)) {
	    Tcl_WrongNumArgs(interp, 2, objv, "phone msg ?actionsent? "
			     "?actiondelivered? ?smsc?");
	    return TCL_ERROR;
	}
	return SendSMS(interp, Tcl_GetString(objv[2]), Tcl_GetString(objv[3]),
		       (objc > 4) ? Tcl_GetString(objv[4]) : NULL,
		       (objc > 5) ? Tcl_GetString(objv[5]) : NULL,
		       (objc > 6) ? Tcl_GetString(objv[6]) : NULL);
    }

    case BORG_speechrecognition: {
	int largc = 0;
	CONST char **largv = NULL;
	static CONST char *CONST speechCmds[] = {
	    "callback", "cancel", "intent", "start", "stop", NULL
	};

jni/tcl/generic/tclStrToD.c became a regular file.

jni/tcl/library/clock.tcl became executable.

jni/tcl/unix/configure.in became a regular file.

jni/tcl/win/tclWinFile.c became executable.

Changes to sdktools/manifest.template.

51
52
53
54
55
56
57

58
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.WRITE_CALENDAR" />
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WRITE_SETTINGS" />
  <uses-permission android:name="android.permission.WRITE_SMS" />

</manifest>







>

51
52
53
54
55
56
57
58
59
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.WRITE_CALENDAR" />
  <uses-permission android:name="android.permission.WRITE_CONTACTS" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WRITE_SETTINGS" />
  <uses-permission android:name="android.permission.WRITE_SMS" />
  <!--uses-permission android:name="android.permission.SEND_SMS"-->
</manifest>

Changes to src/tk/tcl/wish/AndroWish.java.

868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
	return id;
    }

    /*
     * Callback to deal with broadcast intent
     */

    public void broadcastReceived(Intent i) {
	String action = i.getAction();
	String uristr = i.getDataString();
	String type = i.getType();
	String[] cats = null;
	String[] args = null;
	if (i.getCategories() != null) {
	    Set<String> cset = i.getCategories();







|







868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
	return id;
    }

    /*
     * Callback to deal with broadcast intent
     */

    public void broadcastReceived(Intent i, int retcode) {
	String action = i.getAction();
	String uristr = i.getDataString();
	String type = i.getType();
	String[] cats = null;
	String[] args = null;
	if (i.getCategories() != null) {
	    Set<String> cset = i.getCategories();
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
		    args[k] = encodeLongList((long[]) obj);
		} else {
		    args[k] = obj.toString();
		}
		k++;
	    }
	}
	Log.v(TAG, "nativeBroadcastCallback: " + action + "," + uristr +
	      "," + type + "," + cats + "," + args);
	nativeBroadcastCallback(action, uristr, type, cats, args);
    }

    /*
     * Deal with (un)registration of broadcast listeners from Tcl
     */

    public static int handleBroadcastListener(int op, String action) {







|
|
|







922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
		    args[k] = encodeLongList((long[]) obj);
		} else {
		    args[k] = obj.toString();
		}
		k++;
	    }
	}
	Log.v(TAG, "nativeBroadcastCallback: " + retcode + "," + action +
	      "," + uristr + "," + type + "," + cats + "," + args);
	nativeBroadcastCallback(retcode, action, uristr, type, cats, args);
    }

    /*
     * Deal with (un)registration of broadcast listeners from Tcl
     */

    public static int handleBroadcastListener(int op, String action) {
972
973
974
975
976
977
978
































979
980
981
982
983
984
985
		    mSingleton.runOnUiThread(reg);
		    ret = 1;
		}
	    }
	}
	return ret;
    }

































    /*
     * Speech recognition
     */

    public static int speechRecognition(String types[], String[] argv, int id) {
	if (mSpeechRec == null) {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
		    mSingleton.runOnUiThread(reg);
		    ret = 1;
		}
	    }
	}
	return ret;
    }

    /*
     * Send SMS, text only for now
     */

    public static int sendSMS(String phone, String msg, String actionSent,
			      String actionDelivered, String smsc) {
	PendingIntent piSent = null, piDelivered = null;
	if ((phone == null) || (msg == null)) {
	    return 0;
	}
	if (!hasPerm(android.Manifest.permission.SEND_SMS)) {
	    Log.e(TAG, "sendSMS failed: no permission");
	    return 0;
	}
	SmsManager sms = SmsManager.getDefault();
	if (sms == null) {
	    Log.e(TAG, "sendSMS failed: no SmsManager");
	    return 0;
	}
	if (actionSent != null) {
	    piSent = PendingIntent.getBroadcast(mSingleton, 0,
						new Intent(actionSent), 0);
	}
	if (actionDelivered != null) {
	    piDelivered =
		PendingIntent.getBroadcast(mSingleton, 0,
					   new Intent(actionDelivered), 0);
	}
	sms.sendTextMessage(phone, smsc, msg, piSent, piDelivered);
	return 1;
    }

    /*
     * Speech recognition
     */

    public static int speechRecognition(String types[], String[] argv, int id) {
	if (mSpeechRec == null) {
2516
2517
2518
2519
2520
2521
2522
2523

2524
2525
2526
2527
2528
2529
2530
						   String type,
						   String[] cats,
						   String[] args);
    /*
     * Callback to report broadcast intent
     */

    public static native void nativeBroadcastCallback(String action,

						      String uristr,
						      String type,
						      String[] cats,
						      String[] args);

    /*
     * Callback to indicate location update







|
>







2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
						   String type,
						   String[] cats,
						   String[] args);
    /*
     * Callback to report broadcast intent
     */

    public static native void nativeBroadcastCallback(int ret,
						      String action,
						      String uristr,
						      String type,
						      String[] cats,
						      String[] args);

    /*
     * Callback to indicate location update
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
	super();
	mAW = aw;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
	if (intent != null) {
	    mAW.broadcastReceived(intent);
	}
    }

}

/*
 * Helper class to deal with java.util.Locale







|







3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
	super();
	mAW = aw;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
	if (intent != null) {
	    mAW.broadcastReceived(intent, getResultCode());
	}
    }

}

/*
 * Helper class to deal with java.util.Locale

Changes to tcltkapplib/src/tk/tcl/wish/AndroWish.java.

1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
	return id;
    }

    /*
     * Callback to deal with broadcast intent
     */

    public void broadcastReceived(Intent i) {
	String action = i.getAction();
	String uristr = i.getDataString();
	String type = i.getType();
	String[] cats = null;
	String[] args = null;
	if (i.getCategories() != null) {
	    Set<String> cset = i.getCategories();







|







1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
	return id;
    }

    /*
     * Callback to deal with broadcast intent
     */

    public void broadcastReceived(Intent i, int retcode) {
	String action = i.getAction();
	String uristr = i.getDataString();
	String type = i.getType();
	String[] cats = null;
	String[] args = null;
	if (i.getCategories() != null) {
	    Set<String> cset = i.getCategories();
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
		    args[k] = encodeLongList((long[]) obj);
		} else {
		    args[k] = obj.toString();
		}
		k++;
	    }
	}
	Log.v(TAG, "nativeBroadcastCallback: " + action + "," + uristr +
	      "," + type + "," + cats + "," + args);
	nativeBroadcastCallback(action, uristr, type, cats, args);
    }

    /*
     * Deal with (un)registration of broadcast listeners from Tcl
     */

    public static int handleBroadcastListener(int op, String action) {







|
|
|







1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
		    args[k] = encodeLongList((long[]) obj);
		} else {
		    args[k] = obj.toString();
		}
		k++;
	    }
	}
	Log.v(TAG, "nativeBroadcastCallback: " + retcode + "," + action +
	      "," + uristr + "," + type + "," + cats + "," + args);
	nativeBroadcastCallback(retcode, action, uristr, type, cats, args);
    }

    /*
     * Deal with (un)registration of broadcast listeners from Tcl
     */

    public static int handleBroadcastListener(int op, String action) {
1106
1107
1108
1109
1110
1111
1112
































1113
1114
1115
1116
1117
1118
1119
		    mSingleton.runOnUiThread(reg);
		    ret = 1;
		}
	    }
	}
	return ret;
    }

































    /*
     * Speech recognition
     */

    public static int speechRecognition(String types[], String[] argv, int id) {
	if (mSpeechRec == null) {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
		    mSingleton.runOnUiThread(reg);
		    ret = 1;
		}
	    }
	}
	return ret;
    }

    /*
     * Send SMS, text only for now
     */

    public static int sendSMS(String phone, String msg, String actionSent,
			      String actionDelivered, String smsc) {
	PendingIntent piSent = null, piDelivered = null;
	if ((phone == null) || (msg == null)) {
	    return 0;
	}
	if (!hasPerm(android.Manifest.permission.SEND_SMS)) {
	    Log.e(TAG, "sendSMS failed: no permission");
	    return 0;
	}
	SmsManager sms = SmsManager.getDefault();
	if (sms == null) {
	    Log.e(TAG, "sendSMS failed: no SmsManager");
	    return 0;
	}
	if (actionSent != null) {
	    piSent = PendingIntent.getBroadcast(mSingleton, 0,
						new Intent(actionSent), 0);
	}
	if (actionDelivered != null) {
	    piDelivered =
		PendingIntent.getBroadcast(mSingleton, 0,
					   new Intent(actionDelivered), 0);
	}
	sms.sendTextMessage(phone, smsc, msg, piSent, piDelivered);
	return 1;
    }

    /*
     * Speech recognition
     */

    public static int speechRecognition(String types[], String[] argv, int id) {
	if (mSpeechRec == null) {
2571
2572
2573
2574
2575
2576
2577
2578

2579
2580
2581
2582
2583
2584
2585
						   String type,
						   String[] cats,
						   String[] args);
    /*
     * Callback to report broadcast intent
     */

    public static native void nativeBroadcastCallback(String action,

						      String uristr,
						      String type,
						      String[] cats,
						      String[] args);

    /*
     * Callback to indicate location update







|
>







2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
						   String type,
						   String[] cats,
						   String[] args);
    /*
     * Callback to report broadcast intent
     */

    public static native void nativeBroadcastCallback(int ret,
						      String action,
						      String uristr,
						      String type,
						      String[] cats,
						      String[] args);

    /*
     * Callback to indicate location update
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
	super();
	mAW = aw;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
	if (intent != null) {
	    mAW.broadcastReceived(intent);
	}
    }

}

/*
 * Helper class to deal with java.util.Locale







|







3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
	super();
	mAW = aw;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
	if (intent != null) {
	    mAW.broadcastReceived(intent, getResultCode());
	}
    }

}

/*
 * Helper class to deal with java.util.Locale

Changes to tkchat/libs/tcltkapplib.jar.

cannot compute difference between binary files