Commit Graph

12 Commits

Author SHA1 Message Date
Branden Archer
f2007e1693 Change variables which never should change to 'final' 2016-01-01 01:20:26 -05:00
Branden Archer
f49e6be777 Increase TCP send buffer size to the minimum audio buffer size
The original buffer sized used was 1/2 what was intended.
2016-01-01 01:17:35 -05:00
Branden Archer
cfddbf22c1 Explicitly list some methods private
These methods are not needed outside of this class
2015-12-28 17:13:58 -05:00
Branden Archer
c25b0fdeba Allow child device to establish new connection after parent disconnects
Previously the monitor activity would only support one connection,
after which the activity would need to be restarted. With this change,
if a connection is established with a parent device but is eventually
disconnected the child device will begin advertising again.

Note that because the child device can only support one connection
at a time currently, after the connection is established it will
now stop advertising. When a connection is lost and advertising
starts again, it may end up advertising as another service. E.g.
  ProtectBabyMonitor (2)
instead of
  ProtectBabyMonitor
2015-12-28 16:12:49 -05:00
Branden Archer
375242d6fb Cleanup AudioRecord if socket throws an exception
Previously an IOException would prevent the AudioRecord
from being cleaned up.
2015-12-28 16:08:59 -05:00
Branden Archer
0c45351c5a Create wrapper function for unregistering baby monitor service
This will eventually be called in multiple places
2015-12-28 16:06:35 -05:00
Branden Archer
ea29a0f4eb Improve monitor activity with LinearLayout and helper text 2015-12-27 16:20:22 -05:00
Branden Archer
4635a78574 Set the TCP send buffer size to avoid buffering audio
If the send buffer size is large and the receiver is unable
to keep up, then audio samples will collect on the monitor
and lag will accumulate. As only the most recent sample is
important, reduce the send buffer size to the minimum
AudioRecord buffer size.
2015-12-26 17:51:16 -05:00
Branden Archer
828e6a16f6 Stream audio data to connected clients
While connected, send packets of audio data to connected clients.
2015-12-26 17:50:33 -05:00
Branden Archer
7819c31275 Stub for servicing connection to ProtectBabyMonitor service
If a client connects to the advertised ProtectBabyMonitor service,
attempt to service the connection.

For now, simply close the connection instead of sending data.
2015-12-26 15:49:17 -05:00
Branden Archer
716d82dc1c Register ProtectBabyMonitor service via mDNS
When the MonitorActivity is started it will create a ServerSocket.
The assigned port is then advertised over mDNS for a
"ProtectBabyMonitor" service.

Eventually, when something connects to the ServerSocket audio
data will be streamed out.
2015-12-26 15:49:17 -05:00
Branden Archer
11bf3822b6 Add MonitorActivity - for registering on network and sending audio
This commit adds the shell of the MonitorActivity. This activity
will register its service on the local network, wait for a connection,
then send audio data.
2015-12-26 15:49:12 -05:00