Commit graph

49 commits

Author SHA1 Message Date
ehouse
95ad9bbc6e make function signature match param type 2008-07-17 05:07:01 +00:00
ehouse
d96709dffb remove newly-added palm_bt_nameForAddr 2008-01-07 13:36:00 +00:00
ehouse
b3c30161be Add method to lookup hostname without access to btlib state. Some cleanup. 2008-01-07 01:27:45 +00:00
ehouse
81598477a1 ignore timers if state changes after they're set; take down links when resetting 2007-12-31 01:22:03 +00:00
ehouse
ef8a5d0b11 Make initial value of confirmBTConnect true. 2007-12-15 18:55:32 +00:00
ehouse
84b707990e Substitute name of remote host into request for connection
initialization confirmation.
2007-12-15 07:22:12 +00:00
ehouse
c8bbfc5432 Instead of warning user on failure to connect via BT, add preference
to allow user to confirm before every attempt.  Users will learn to
set this when T650s are in the mix.  Save a new preference, and up the
stream version.  Up beta version.  Add the preference both to the prefs
dialog and to the bluetooth connection (for guest) dialog, with both
impacting the same field in gamePrefs.
2007-12-14 03:38:55 +00:00
ehouse
385423f695 Add non-sf.net contact options; make params const. 2007-12-09 23:37:47 +00:00
ehouse
63ccaed46e cleanup; replace a bunch of EvtAddEventToQueue calls with
postEmptyEvent; pass transport type with incoming packets so they can
be rejected if not on expected channel (to stop IR, which is always
on, from injecting into a BT game); do BT work and fire timers even
when menu is down; don't let robot run until after board is drawn for
the first time; on startup, don't let robot run until after board is
drawn once.  Up version to b3.
2007-12-09 01:59:15 +00:00
ehouse
bf3ccf1bad Remove unused FindTrustedDevice calls; don't try to become master or slave
until we know which we'll be.  This likely fixes the problem where devices
have trouble connecting after switching roles.
2007-12-07 09:50:48 +00:00
ehouse
244e600afa call util_addrChange prior to closing comms to fix crash moving from
BT to standalone game; add a couple of similar assertions; up beta
version.
2007-12-07 07:50:19 +00:00
ehouse
f70bdb54ae Remove excessive focus logging; fix timer bug for BT by posting event so EvtGetEvent can exit 2007-12-06 05:26:44 +00:00
ehouse
e4b01a514b Change state icon even when not doing work to get it to show up (unconnected) earlier. 2007-12-05 06:26:21 +00:00
ehouse
0d5543b28f Fix dialog title; send heartbeat based on when connected even if no
messages yet received; reset bt connection on palm in two stages;
remove unused param.  Change version number for beta.
2007-12-03 01:20:32 +00:00
ehouse
b527110379 replace all __FUNCTION__ with __func__ 2007-12-02 19:13:25 +00:00
ehouse
321acd1d42 Add and set a compile-time option so comms will set a periodic timer
and use it to send and check for heartbeats over any transport.
Caller must supply a reset proc which is called when heartbeat hasn't
been received in too long.  No changes required to comms protocol, but
that means the heartbeat interval is fixed at compile time: can't be
negotiated, and the two ends had better agree.  Currently tested with
linux host and PalmOS guest, where only the first heartbeat failure is
recovered from.  So there's some debugging to be done still.
2007-11-18 23:43:27 +00:00
ehouse
f752eace94 Fix bug reassembling packets; advance credit on each send/receive.
With this checkin rfcomm works between two Treos and between Treos and
linux, though with plenty of bugs around reconnecting yet to find.
However, it turns out that even using rfcomm a Treo650 gives no notice
to the other device when shutting down the connection, so rfcomm
doesn't help.  Rfcomm is probably not worth using, but the code's now
here and can be turned on in the Makefiles.
2007-11-18 17:57:28 +00:00
ehouse
0cdd8a41c4 Add code, disabled in Makefile, to use rfcomm rather than l2cap for
data with the goal of detecting disconnects more quickly.  Stops
working after a few packets (client only tested against host on linux
so far), and doesn't compile for ARM yet, but the framework is there.
Am framing packets on Palm side which may not be necessary.
2007-11-15 14:39:33 +00:00
ehouse
4fb097369e Fix reconnect bug: when master's in initial state but listening socket
already inited, shift state to listening
2007-11-10 17:54:05 +00:00
ehouse
d1054a52ff Use a single general-purpose callback passed into palm_bt_doWork where
it's needed, removing those passed into _init and _send.  When client
is unable to connect to host, raise alert to user and give choice to
continue trying.  Clear 'suspendBT' flag when user manually resends or
opens different game.  Currently this happens only on guest's failure
to find registered SDP; should also extend to remote device not
running at all and to host failure to send to guest.
2007-11-07 13:40:56 +00:00
ehouse
a3ef550426 Use fixed action queue and memcpy rather than rotating buffer; eliminate sequential duplicates of most actions. 2007-11-06 04:05:11 +00:00
ehouse
9f1d02c7cd Byte-swap psm field to callback on ARM: now both client and host work. Move SDP-related constants out where linux can use too. 2007-11-03 22:04:06 +00:00
ehouse
57baefaf5f Publish (master) and look for (slave) SPD record so that we're looking for our app and not just BT when connecting. I hoped this would prevent T650s from crashing when nothing's running. It doesn't, but it's the right way to connect, and will allow better error messages or retry logic. Compiles only on 68K at the moment. 2007-09-15 13:50:07 +00:00
ehouse
a79d36a150 Use a timer to avoid trying to get an ACL connection too frequetly.
This seems to trigger crash Treo650s far less often than constantly
retrying.
2007-05-26 22:51:25 +00:00
ehouse
9a86b69527 If BT is off, ask user to turn it on only once. If cancels, warn that
it must be turned on, and don't attempt to turn it on again.  This
prevents BTLib from repeatedly asking for permission to turn BT on.
2007-04-15 16:46:17 +00:00
ehouse
0423ef6152 Return null rather than allocing bt storage if unable to open bt library. 2007-04-13 08:47:22 +00:00
ehouse
5334876568 comment out assert that doesn't seem to matter 2007-03-17 17:31:01 +00:00
ehouse
66d8a99bb1 Put back code to associate service record with listening socket, but
ifdef'd out as it doesn't seem to make any difference.
2007-03-17 15:34:24 +00:00
ehouse
3cf22d6302 compare only six bytes of struct ARM pads to 8. 2007-03-15 05:06:56 +00:00
ehouse
ca849ea934 define constant so tests work on ARM too. 2007-03-09 03:00:44 +00:00
ehouse
129f551737 close and reopen bt module with every new game to fix, badly, client's
failure to connect if it's restarted before host; add event and use to
retry BtLibSocketListen when fails (since failure is usually
temporary).
2007-02-05 04:20:13 +00:00
ehouse
6af89b4182 Add assert; don't call comms if has been set to null (fixes device
reset); fix failure to install connCB (removes need to manually resend
messages when client starts up first.)
2007-02-04 17:13:01 +00:00
ehouse
49d0d2b8f8 Turn on BT so 4.3a4 can have a non-M rev number; up version for 4.2. 2007-02-03 20:36:22 +00:00
ehouse
c06df68133 fix crash when FIVEWAY not on. 2006-11-12 14:28:43 +00:00
ehouse
4e7ed26704 Fix messages getting dropped when remote device isn't connected by, on
getting a new connection, making a callback that calls resend_all().
This means a lot of duplication, but duplication is free with
bluetooth.  The underlying problem is that packets are reported as
sent not when acked by the other side, but when passed to a lower
level that may not be connected at all.
2006-11-11 22:52:39 +00:00
ehouse
1aa6d81177 When bt init fails, put up alert; check for failure after and don't
crash; erase bt status area even when no comms in order to erase after
turning bt off; in connect dlg, use a trigger rather than field and
button for host name.
2006-10-15 16:14:42 +00:00
ehouse
ddecfad8d1 get rid of extra log statement 2006-10-11 02:02:53 +00:00
ehouse
e63ad30e52 Add a bit more logging; do a better job of changing roles. Now can switch
roles with a new game and communication starts without a restart of the
app.
2006-10-07 03:40:29 +00:00
ehouse
7cbc781a07 Add quick hack to show BT connect state on main board, to be replace
by icons or something prettier later.  For new games dialog, replace
hard-coded list of controls to ignore with a runtime list.  This
allows checkboxes and fields to be enabled and disabled more easily.
Works around Palm's lack of a control state meaning "visible but
inactive" that works for all form elements.
2006-09-24 17:56:14 +00:00
ehouse
a88d079029 Add debug menu and in response dump bt state to stream for display.
Track sends and receives.  Add listening state for master, and don't
reset its acl when slave goes away.
2006-09-23 22:58:33 +00:00
ehouse
aee519e453 Don't use service records; don't reset connection state as part of
reset for new game; handle case where callback happens inside of
BtLibLinkDisconnect call.
2006-09-23 15:24:30 +00:00
ehouse
e17a442964 strutils macro change; tweak so compiles non-DEBUG and without Bluetooth 2006-09-15 07:42:10 +00:00
ehouse
d06daad4f0 Names change only: it's actions, not events, that are postponed. 2006-09-14 01:57:40 +00:00
ehouse
3b98337eec Better handling of disconnect and reconnect; esp. slave will keep
trying to connect after losing contact with server.  With this
checkin, a game between palm and linux can be interrupted by either or
both and restarted, with either in either role.  Haven't tested
palm-on-palm yet.  App stop speed is much better now too.
2006-09-14 01:38:09 +00:00
ehouse
c068126c56 tweaks to re/connect logic; process incoming data from main event loop
and enqueue more than one at a time; wipe existing queue when reinited.
2006-09-10 18:34:57 +00:00
ehouse
f46ae953e8 Lots of changes aimed at allowing to quit and restart in the middle of
a BT game: track states so can shutdown cleanly; transition from
master to slave; mechanism to defer work from callbacks to the main
loop.  Can now quit and restart as guest against host on linux.  Have
not tested between two Treos.
2006-09-08 07:06:21 +00:00
ehouse
29c8b461b8 hardcode psm (for now), and remove spd lookup stuff. Was needed to
connect to linux server which doesn't add spd records yet.
2006-08-29 13:23:00 +00:00
ehouse
7d48f2e430 Put up BT device browser while user is picking connection method
rather than when trying to send for first time, then pass address
through from conns dialog to bt code.
2006-08-26 21:12:10 +00:00
ehouse
3c6405d0d1 First shot at bluetooth support (turned off in Makefile by default).
A full robot vs. robot game now works between two Treos.  Added UI to
choose BT as transport mechanism, and added new send proc to establish
socket connection between host and guest.  Works only for two devices:
no piconet yet.  No error recovery, ability to quit game in middle,
start new game, etc.
2006-08-23 04:44:55 +00:00