jcs
/wifi_da
/amendments
/27
*: Add dialog to manually specify another/hidden SSID
jcs made amendment 27 2 months ago
--- README Sun Jan 28 00:05:35 2024
+++ README Tue Sep 17 20:46:39 2024
@@ -18,6 +18,11 @@ To install on System 6, use the Font/DA Mover utility:
There should now be a Wi-Fi option in the Apple menu.
+Change history:
+
+1.2 - 2024-09-18
+ - Add option to manually specify another (possibly hidden) SSID
+
1.1 - 2024-01-29
- Fix password entry in connection dialog on Mac OS 8+
--- wi-fi.h Sat Jan 27 23:43:26 2024
+++ wi-fi.h Tue Sep 17 20:22:36 2024
@@ -35,6 +35,9 @@
#define ABOUT_DIALOG_ID 2
+#define SSID_DIALOG_ID 3
+#define SSID_DIALOG_NAME_FIELD_ID 3
+
#define BLUESCSI_NETWORK_WIFI_CMD 0x1c
#define BLUESCSI_NETWORK_WIFI_CMD_SCAN 0x01
#define BLUESCSI_NETWORK_WIFI_CMD_COMPLETE 0x02
@@ -73,7 +76,8 @@ struct wifi_network_entry {
char rssi;
unsigned char channel;
unsigned char flags;
-#define WIFI_NETWORK_FLAG_AUTH 0x1
+#define WIFI_NETWORK_FLAG_AUTH (1 << 1)
+#define WIFI_NETWORK_FLAG_HIDDEN (1 << 2)
char _padding;
};
--- Wi-Fi DA.π.r Sun Jan 28 00:11:11 2024
+++ Wi-Fi DA.π.r Tue Sep 17 20:45:37 2024
@@ -8,7 +8,7 @@ data 'DITL' (-16000) {
$"5E30 5E31 5E32 5E33" /* ^0^1^2^3 */
};
-data 'DITL' (-15999, "CONNECT") {
+data 'DITL' (-15999, "PASSWORD") {
$"0005 0000 0000 0050 0136 0064 017F 0407" /* .......P.6.d.... */
$"436F 6E6E 6563 745B 0000 0000 0050 00E6" /* Connect[.....P.. */
$"0064 012F 0406 4361 6E63 656C 0000 0000" /* .d./..Cancel.... */
@@ -28,6 +28,17 @@ data 'DITL' (-15998, "ABOUT", purgeable, preload) {
$"0000 FFD8 0106 011E C002 C180" /* ...ÿ....¿.¡Ä */
};
+data 'DITL' (-15997, "SSID") {
+ $"0004 0000 0000 0041 0136 0055 017F 0408" /* .......A.6.U.... */
+ $"436F 6E74 696E 7565 0000 0000 0041 00E6" /* Continue.....A.. */
+ $"0055 012F 0406 4361 6E63 656C 0000 0000" /* .U./..Cancel.... */
+ $"0023 005A 0033 017D 1000 0000 0000 0023" /* .#.Z.3.}.......# */
+ $"000A 0033 0055 8805 5353 4944 3A00 0000" /* ...3.Uà.SSID:... */
+ $"0000 000A 000A 001C 0105 881D 456E 7465" /* ..........à.Ente */
+ $"7220 7468 6520 5769 2D46 6920 6E65 7477" /* r the Wi-Fi netw */
+ $"6F72 6B20 5353 4944 3A00" /* ork SSID:. */
+};
+
data 'MENU' (-15999) {
$"C181 0000 0000 0000 0000 FFFF FFFF 0557" /* ¡Å.............W */
$"692D 4669 0E41 626F 7574 2057 692D 4669" /* i-Fi.About Wi-Fi */
@@ -50,6 +61,12 @@ data 'DLOG' (-15998) {
$"0000 C182 0000 280A" /* ..¡Ç..(. */
};
+data 'DLOG' (-15997) {
+ $"0076 0036 00D4 01C4 0010 0000 0100 0000" /* .v.6.‘.ƒ........ */
+ $"0000 C183 0A57 692D 4669 2053 5349 4477" /* ..¡É.Wi-Fi SSIDw */
+ $"680A" /* h. */
+};
+
data 'SICN' (-16000) {
$"0000 6006 700E 3FFC 1FF8 3E7C 67E6 4FF2" /* ..`.p.?...>|g.O. */
$"1BD8 17E8 0FF0 1C38 399C 718E 6006 0000" /* .ÿ.....89úqé`... */
@@ -92,7 +109,7 @@ data 'BNDL' (-16000) {
};
data 'vers' (1) {
- $"0110 8000 0000 0331 2E31 2B31 2E31 20A9" /* ..Ä....1.1+1.1 © */
+ $"0120 8000 0000 0331 2E32 2B31 2E32 20A9" /* . Ä....1.2+1.2 © */
$"2032 3032 332D 3230 3234 2C20 6A6F 7368" /* 2023-2024, josh */
$"7561 2073 7465 696E 203C 6A63 7340 6A63" /* ua stein <jcs@jc */
$"732E 6F72 673E" /* s.org> */
@@ -531,7 +548,7 @@ data 'PICT' (-16000) {
};
data 'dast' (-16000) {
- $"5D76 312E 310D 4465 736B 2041 6363 6573" /* ]v1.1¬Desk Acces */
+ $"5D76 312E 320D 4465 736B 2041 6363 6573" /* ]v1.2¬Desk Acces */
$"736F 7279 2066 6F72 2042 6C75 6553 4353" /* sory for BlueSCS */
$"490D A920 3230 3234 2C20 6A6F 7368 7561" /* I© 2024, joshua */
$"2073 7465 696E 0D0D 5765 623A 2068 7474" /* stein¬¬Web: htt */
--- window.c Sat Jan 27 23:53:39 2024
+++ window.c Tue Sep 17 20:38:48 2024
@@ -20,6 +20,7 @@
#define NO_DEVICE_TEXT "\pNo Device Found"
#define NO_NETWORK_TEXT "(No Network)"
+#define OTHER_NETWORK_TEXT "(Other Network)"
#define DA_HEIGHT 25
#define DA_WIDTH 180
@@ -240,7 +241,7 @@ update_wifi_ssid_list(bool update_networks)
nwifi_menu_networks = nitems(wifi_menu_networks);
DEBUG_LOG(("capping nets to %d", nwifi_menu_networks));
}
-
+
/* add each additional network from the scan, excluding current */
for (n = 0, m = 1; n < nwifi_menu_networks; n++) {
if (strcmp(wifi_scan_networks[n].ssid,
@@ -258,9 +259,17 @@ update_wifi_ssid_list(bool update_networks)
nwifi_menu_networks = m;
- if (wifi_menu_networks[0].ssid[0] == '\0')
+ if (wifi_menu_networks[0].ssid[0] == '\0') {
strlcpy(wifi_menu_networks[0].ssid, NO_NETWORK_TEXT,
sizeof(wifi_menu_networks[0].ssid));
+ nwifi_menu_networks++;
+ }
+
+ /* keep "other network" as last entry */
+ strlcpy(wifi_menu_networks[nwifi_menu_networks - 1].ssid,
+ OTHER_NETWORK_TEXT, sizeof(wifi_menu_networks[0].ssid));
+ wifi_menu_networks[nwifi_menu_networks - 1].flags =
+ WIFI_NETWORK_FLAG_AUTH | WIFI_NETWORK_FLAG_HIDDEN;
/* leave the first item and we'll set its text later */
while (CountMItems(ssid_menu) > 1)
@@ -289,7 +298,7 @@ update_wifi_ssid_list(bool update_networks)
mitem++;
}
-
+
update_window(true);
}
@@ -325,8 +334,7 @@ destroy_window(void)
void
window_mousedown(Point p)
{
- Str255 password;
- char ssid[64];
+ Str255 password, ssid;
Rect r, irect;
GrafPtr savePort;
short mitems, n, selitem, hit, itype;
@@ -373,10 +381,46 @@ window_mousedown(Point p)
net = &wifi_menu_networks[loword(new_net) - 1];
memset(&wjr, 0, sizeof(wjr));
- strlcpy(wjr.ssid, net->ssid, sizeof(wjr.ssid));
+
+ if (net->flags & WIFI_NETWORK_FLAG_HIDDEN) {
+ dg = GetNewDialog(OwnedResourceID(SSID_DIALOG_ID), 0L,
+ (WindowPtr)-1L);
+ center_in_screen(((DialogPeek)dg)->window.port.portRect.right,
+ ((DialogPeek)dg)->window.port.portRect.bottom, false, &r);
+ MoveWindow(dg, r.left, r.top, false);
+
+ ShowWindow(dg);
+ SetPort(dg);
+
+ /* outline continue button */
+ GetDItem(dg, ok, &itype, &ihandle, &irect);
+ PenSize(3, 3);
+ InsetRect(&irect, -4, -4);
+ FrameRoundRect(&irect, 16, 16);
+ PenNormal();
+
+ for (;;) {
+ ModalDialog(WiFiPasswordDialogFieldFilter, &hit);
+ if (hit == ok || hit == cancel)
+ break;
+ }
+
+ if (hit != ok) {
+ DisposDialog(dg);
+ goto menu_done;
+ }
+
+ GetDItem(dg, SSID_DIALOG_NAME_FIELD_ID, &itype, &ihandle, &irect);
+ GetIText(ihandle, &ssid);
+ PtoCstr(ssid);
+ strlcpy(wjr.ssid, (char *)ssid, sizeof(wjr.ssid));
+
+ DisposDialog(dg);
+ } else
+ strlcpy(wjr.ssid, net->ssid, sizeof(wjr.ssid));
if (net->flags & WIFI_NETWORK_FLAG_AUTH) {
- strlcpy(ssid, net->ssid, sizeof(ssid));
+ strlcpy((char *)ssid, wjr.ssid, sizeof(ssid));
CtoPstr(ssid);
ParamText(ssid, "\p", "\p", "\p");
PtoCstr(ssid);