Commit graph

5429 commits

Author SHA1 Message Date
Eric House
75cb8cae9c factor code and log bt name of local device on startup -- no
significant change.
2012-02-09 18:48:26 -08:00
Eric House
74aeeca8e0 move BT device listing into its own Activity. Call it from
NewGameActivity and from BoardActivity when the new notifyMissing
method gets called.  Works as before called from NewGameActivity but
BoardActivity crashes on iterating over list of devices returned.
2012-02-09 05:21:23 -08:00
Eric House
0755a9e781 add new util function that gets called when a game is opened to inform
it if any players are missing.  Idea's to allow for non-relay devices
the invitation opportunity that comes when a game connects to the
relay and learns that no other games have joined its room.
2012-02-09 05:19:03 -08:00
Eric House
79a897b428 fix assert (but still leaking) 2012-02-09 05:16:32 -08:00
Eric House
764180fc48 remove unused member 2012-02-09 05:15:09 -08:00
Eric House
8fb962eaab strings for new layout 2012-02-09 04:46:58 -08:00
Eric House
ea0893bad6 layout for replacement for BT-device chooser dialog -- so can be
called from other places.
2012-02-09 04:46:01 -08:00
Eric House
be8d3e8b5a when receiving a message for a game that no longer exists, reply to
that effect, and on receipt of that reply offer to delete the local
copy.
2012-02-08 06:41:39 -08:00
Eric House
bf5b6ada77 include public-room column 2012-02-07 18:59:17 -08:00
Eric House
15f8cd5b33 post notifications when moves arrive and game isn't open. And handle
BAD_PROTO event (untested).
2012-02-07 18:41:56 -08:00
Eric House
ba40028a91 raise an error when unexpected protocol received. Later I can add a
user-visible message.
2012-02-07 18:11:56 -08:00
Eric House
898d9c339a add protocol-identifier byte. For now just assert it matches. 2012-02-07 18:05:06 -08:00
Eric House
ac2ac47aed code cleanup: make treads own their queue datastructures, use methods
to stop them, etc.  Heading toward making it easier to detect when the
BT stack is hosed and user needs to be warned or told to get a better
phone.
2012-02-07 17:42:01 -08:00
Eric House
3bda56420c turn on XWFEATURE_BLUETOOTH 2012-02-07 17:38:50 -08:00
Eric House
7214b7e12a turn off the palmos-era bt wrapper stuff I was trying to use to know
when to reset the stack.  It breaks Android when I turn on
XWFEATURE_BLUETOOTH and adds no value I can see.
2012-02-07 17:38:24 -08:00
Eric House
aca4e1fed8 init db before using it 2012-02-07 07:06:25 -08:00
Eric House
bde5910c2a Merge branch 'android_branch' into android_bt 2012-02-07 06:21:13 -08:00
Eric House
49a3f1cad6 git-copied (using checkout) from android_bt 2012-02-07 06:20:51 -08:00
Eric House
e0ee197888 make relay check happen on demand, not many minutes later. 2012-02-06 21:35:11 -08:00
Eric House
c8d4090510 another change for b42 2012-02-06 19:26:56 -08:00
Eric House
47c3bd3090 track a BT game's set (singleton for two-device game) of remote
devices in summary DB so, e.g., we can quickly determine what games
care when a devices becomes available via BT.  First use of this is
notifying when a remote game's deleted -- least that's the plan.  This
commit just adds to the DB and scans the DB to build a map of
device->gameIDs array.
2012-02-06 19:02:19 -08:00
Eric House
52ffefb173 add new column to store mac addresses of remote devices in this game via BT. 2012-02-06 18:57:30 -08:00
Eric House
796baffa6d Merge branch 'android_branch' into android_bt 2012-02-06 18:13:57 -08:00
Eric House
d3bb7d490a simplify cursor code 2012-02-06 18:12:28 -08:00
Eric House
bfe04a08b5 removed unneeded null-byte addition 2012-02-06 18:11:30 -08:00
Eric House
39e30184b1 move responsibility for letting other device know a participant game
has loaded into CommsTransport.
2012-02-06 06:53:28 -08:00
Eric House
d8ee493f1b On "configure first" BT newgame button, create the game then launch
the GameConfig activity.  If the user exits other than with "play
game", delete it so user never sees it.  Otherwise launch it.  Next
step is to detect a BT host that's missing clients and offer to invite
them.
2012-02-06 06:29:37 -08:00
Eric House
606e733b19 add _ to typedef to reduce number of etags hits on name. No code change. 2012-02-06 06:27:53 -08:00
Eric House
4deb1d3a77 add threadKiller to close sockets when remote isn't responding --
which can sometimes be for minutes with the Moment at least.  Make
name->hwaddr Map static since it might as well outlive a Service
instance (though right now I'm clearing it all the time.)
2012-02-05 21:47:26 -08:00
Eric House
99e001b8a2 launch game after creating it 2012-02-05 21:45:21 -08:00
Eric House
0cc7ad3e49 start from gameID in onCreate as well as onNewIntent. 2012-02-05 21:44:52 -08:00
Eric House
a2b5274b6c on ICS CreateGlobalRef doesn't return the same value as is passed in.
So stop assuming it does!  Fixes multiple crashes on ICS and need to
be ported to android_branch.
2012-02-05 19:12:09 -08:00
Eric House
8947ddca0b on ICS CreateGlobalRef doesn't return the same value as is passed in.
So stop assuming it does!  Fixes multiple crashes on ICS and need to
be ported to android_branch.
2012-02-05 19:11:38 -08:00
Eric House
bc8299fe30 run accept() with timeout so it'll show up in logs when the thread
died.  I hope.
2012-02-03 17:30:47 -08:00
Eric House
cc9f2b793e enhance receiver to get BT on/off and connect attempts and to start
bt service in response.
2012-02-03 17:29:40 -08:00
Eric House
6982545f59 Recipient of BT new-game invitation puts up Notification after
creating it that will launch it.
2012-02-03 17:21:17 -08:00
Eric House
3026a7e4f8 fix compile warning 2012-02-03 17:14:04 -08:00
Eric House
121e4a5d1d remove unused import statements: no code change 2012-02-03 17:12:14 -08:00
Eric House
cebb002fd0 add state summaries for BT games too 2012-02-03 17:09:59 -08:00
Eric House
8793d8f4fd include seed and missingPlayers in any non-standalone game summary 2012-02-03 17:03:47 -08:00
Eric House
a392826ebf move notification posting into new method that can be called from
elsewhere.
2012-02-03 06:25:17 -08:00
Eric House
e53621a5bc fix compile warnings 2012-02-03 05:43:17 -08:00
Eric House
82586668f9 move bteventhandler implementation up into XWActivity so subclasses
can easily listen for one or two events.  Have Board listen to events
for un/successful message sends and up up icon to indicate if BT is
working.
2012-02-01 18:51:41 -08:00
Eric House
00a0ecb1b8 icons stolen from ubuntu as placeholders for BT-working and -not. 2012-02-01 18:49:42 -08:00
Eric House
b3fdcecaf4 send result (failure) for SEND even if there's an exception 2012-02-01 18:42:30 -08:00
Eric House
6b600f4d9b Merge remote branch 'origin/android_branch' into android_branch 2012-02-01 07:13:15 -08:00
Eric House
ab32480cd5 Even host needs an address to mark game as BT 2012-02-01 07:00:25 -08:00
Eric House
5e330595fc pass bt address as well as name, and use when available -- since OS
doesn't provide ready name->addr translation.
2012-02-01 06:50:19 -08:00
Eric House
afac1cc5bd add BTReceiver -- will need to know when BT goes up and down. 2012-02-01 06:13:55 -08:00
Eric House
26109f926b implement BT's "configure first" to create a BT game without any other
device being involved.  Useful for testing of config.  Might be the
basis for getting games going with non-default settings but I'm not
sure how to get them all set up with the same gameID so they'll
connect.
2012-01-31 18:52:18 -08:00
Eric House
b4b7609894 include hwAddr as well as device name in bt section of address 2012-01-31 18:48:59 -08:00
Eric House
af2fcc76e0 consider it an error if no dicts found for language. With this change
I can install a game for which there's no dict and when user opens it
he'll get an opportunity to download one.  Might be better to refuse
to install it....
2012-01-31 18:47:38 -08:00
Eric House
5c8488af1b string and layout needed for edb39ac77d 2012-01-31 18:45:00 -08:00
Eric House
6326e45892 make btAddr a string rather than array of bytes. 2012-01-31 18:43:26 -08:00
Eric House
edb39ac77d remove assumptions that non-standalone==relay. BT games now
configurable (though no BT-specific settings are exposed).
2012-01-31 18:28:49 -08:00
Eric House
e91c0daf65 check for null obj before calling through its vtable 2012-01-31 06:44:54 -08:00
Eric House
579e8b7dfd send language and player counts with invitations. Works as long as
the recipient has a dict in the lang; otherwise crashes on that device.
2012-01-30 20:41:50 -08:00
Eric House
6978ba06f1 kick off scan immediately if have no devices to present 2012-01-30 19:39:45 -08:00
Eric House
82529c738e add start/stopProgress methods and push to DlgDelegate so can be used
from other Activities.  Use while sending game info as well as scanning.
2012-01-30 19:33:56 -08:00
Eric House
cd8ace6c9f queue isn't meant to be static 2012-01-30 19:32:56 -08:00
Eric House
144db5628f Merge branch 'android_branch' into android_bt 2012-01-30 18:47:10 -08:00
Eric House
0b197bf12e include DbgUtils to make debug changes easier. No code change. 2012-01-30 18:46:51 -08:00
Eric House
ad5b42121b revert recently-added typo 2012-01-30 18:39:11 -08:00
Eric House
b4f9553579 install into devices too 2012-01-30 18:38:43 -08:00
Eric House
06d8df4fb5 remove dead file 2012-01-30 06:39:54 -08:00
Eric House
094d08e903 Get play via BT working!!! Replace BTConnection with BTService to make
keeping the listener/sender threads going much easier.  Create new
message sink to dispatch incoming messages, and start passing return
addresses into comms (not required before when relay was only
transport as it has no return addresses.)
2012-01-30 06:39:18 -08:00
Eric House
3f03232008 include jni log messages too 2012-01-30 06:34:15 -08:00
Eric House
786cb4dc55 replaces BTConnection (and uses a lot of its code) 2012-01-30 06:26:48 -08:00
Eric House
edaef7f0a4 add new column 2012-01-26 23:02:56 -08:00
Eric House
698dac890f combine bt receivers, and start listening when ACL connected. Less
reliable but means I don't have to powercycle BT every time I install.
2012-01-26 07:14:43 -08:00
Eric House
bc351d1675 add ok button to dialog listing paired devices, make them selectable,
and don't dismiss/invite until the ok button's tapped.
2012-01-26 06:54:55 -08:00
Eric House
6bfd6e74e6 Merge branch 'android_branch' into android_bt 2012-01-26 06:24:18 -08:00
Eric House
9f2ec43617 move ProgressDialog into NewGameActivity where it belongs. 2012-01-26 06:23:46 -08:00
Eric House
adf49dffd7 init/take down thread local storage in constructor/destructor rather
than as static initializer (and then leaking on shutdown.)
2012-01-26 05:48:10 -08:00
Eric House
866aeb2387 change relay connect message format to include client version (meaning
of which is TBD).  When a new-version client connects, store the value
it's passed. At first this will let me track how quickly people
upgrade.  Later I can use it to let different clients have different
formats to their messages e.g. to proxy.
2012-01-26 05:43:54 -08:00
Eric House
af26ebfff9 fix usage hint 2012-01-26 05:40:22 -08:00
Eric House
da9f206f86 fix scan. 2012-01-25 18:56:40 -08:00
Eric House
5ca35254cc pass messages to BT and send them -- they're received on the other
side but not yet acted on.  Combine several send threads into one so
that all bt socket operations will be in the same thread and can't
coincide.  (Rescan is broken.)
2012-01-25 18:32:07 -08:00
Eric House
8959dc09a2 add -g option that filters for xw4 2012-01-25 18:28:25 -08:00
Eric House
0934f83106 add gameID to params passed to comms' sendproc, including passing
through to java layer.
2012-01-25 18:27:37 -08:00
Eric House
813e31ada8 fix crash by checking for null socket (meaning unable to open
connection to relay)
2012-01-25 18:09:26 -08:00
Eric House
74efac3dd9 include bt name of host in client games, but not of client[s] in host
games.  This allows clients to pass host name for use in addressing
when their initial message is sent.
2012-01-24 06:53:50 -08:00
Eric House
ac6ecfa845 copy bt_hostName as part of address 2012-01-24 06:51:40 -08:00
Eric House
a543bfa639 send new gameID so it actually arrives. Games are being created on
both ends with the same gameID.
2012-01-24 06:28:55 -08:00
Eric House
b954ef0643 revert recently-added typo 2012-01-24 06:21:43 -08:00
Eric House
4e1e5ab303 script to make it easier to run two or more logcat sessions 2012-01-24 06:21:12 -08:00
Eric House
c425686589 lots of changes. Respond to new-bt-game button by posting a list of
known paired-with-Crosswords devices and sending invite to the one
selected.  Includes rescan button with infinite progress indicator
(that sometimes works).  Recipient saves new game with the gameID
passed.  Then sender does too (but gameID doesn't seem to stick.)
Both games crash when you open them, but they're created.
2012-01-23 20:52:04 -08:00
Eric House
f048980701 cleanup 2012-01-23 20:49:34 -08:00
Eric House
2c24441ff3 create BT game and display with BT icon using hard-coded defaults for
now and no addressing.  Fails in assert when trying to send as BT
addressing isn't handled yet.
2012-01-23 07:54:22 -08:00
Eric House
beef55e3ac formatting 2012-01-23 07:52:46 -08:00
Eric House
f42f9adad1 use listener to ensure that BT-related UI is enabled/disabled when
power state changes.
2012-01-23 06:37:54 -08:00
Eric House
eb214d4f69 Turn on BT in response to user tapping "turn on" button. Still to do:
listen for BT turnoff/on that's independent of the button and
re-layout -- in case user does it himself while the NewGame Activity
is frontmost.
2012-01-21 10:19:36 -08:00
Eric House
18b620732b fix missing buttons 2012-01-21 10:17:07 -08:00
Eric House
81e29482fe add buttons, text etc. still to be determined, to start BT games. Add
text and unimplemented button to turn BT on if it's not there.
2012-01-21 09:46:52 -08:00
Eric House
6d93fcfdd3 install into devices too 2012-01-21 08:50:12 -08:00
Eric House
adb5ce541d add room name to subject of invite 2012-01-20 17:35:50 -08:00
Eric House
548fb86734 Play around with getting notified when another device connects. I
need an alternative to keeping a listening socket open in a thread
forever, as the OS will eventually shut me down if there's memory
pressure.
2012-01-19 22:32:34 -08:00
Eric House
847f1199be add gameID to summary. The slot's already in the DB, though unused,
so no version change required.
2012-01-19 18:53:55 -08:00
Eric House
923d6a24bd use libuuid to prep BT UUID, now a string instead of an array of bytes
for ease of use from java.  Since libbluetooth stupidly and
unrepentantly redefines uuid_t, add a new file/function to call
libuuid without having to pull its definitions into the bt code.  This
code compiles but is completely untested: I don't quite remember how
to play games via BT on Linux and at any rate will need an always-on
listener like the one I'm adding to the Android client.
2012-01-19 18:52:33 -08:00
Eric House
a34921155f make gameID consistently 32 bits in C code. It's been stored as 16,
so stream version must change.  Plan's to use it to address incoming
BT packets so a game needn't be open to receive.
2012-01-19 18:47:53 -08:00