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
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.
If a client connects to the advertised ProtectBabyMonitor service,
attempt to service the connection.
For now, simply close the connection instead of sending data.
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.
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.