Artifact 2304b41252d8dc366ce476d73b392123a6094350:
Wiki page
[
rfcomm command] by
chw
2019-08-08 05:25:27.
D 2019-08-08T05:25:27.069
L rfcomm\scommand
P aba82129089db95c3dc3210846c0b1282f13f96a
U chw
W 2133
<h2>rfcomm command</h2>
<h3>Name</h3>
<b>rfcomm</b> - transfer data over Bluetooth serial port profile;
akin to the Tcl <tt>socket</tt> command.
<h3>Synopsis</h3>
<tt>package require Rfcomm</tt><br>
<tt>rfcomm ?-myaddr <i>addr</i>? ?-myport <i>myport</i>? ?-async?
<i>host</i> <i>port</i></tt><br>
<tt>rfcomm -server <i>command</i> ?-myaddr <i>addr</i>? <i>port</i></tt>
<h3>Description</h3>
This command is used to obtain a channel which is able to transfer data
over Bluetooth's serial port profile (SPP or SP). The arguments are
nearly identical to the Tcl <tt>socket</tt> command. It returns a client
or server channel handle. Client channels may be used with <tt>gets</tt>,
<tt>read</tt>, <tt>puts</tt>, <tt>fconfigure</tt>, and <tt>close</tt>.
Server channels return a new client channel in the <tt><i>command</i></tt>
callback when an incoming connection was established.
For client channels (first command form), the <tt><i>host</i></tt> parameter
must be given as a one- or two-element list: the first element is the
Bluetooth address of the remote device, and the (optional) second element
is the UUID of the remote service. If omitted the standard Bluetooth UUID
for the Serial Port Profile <tt>00001101-0000-1000-8000-00805F9B34FB</tt> is
used. The non-blocking connection mode (<tt>-async</tt> specified) uses
readability of the channel to indicate connection state. This is different
to normal <tt>socket</tt> channels, where writability provides this
information. On Android, the local address of the client socket specified
in the optional <tt><i>addr</i></tt> parameter is ignored.
For server channels, the first element of the <tt><i>addr</i></tt>
parameter is the UUID for the local SDP (Service Discovery Protocol)
record, i.e. the application identifier, and the optional second element
is the friendly name of the service as advertised over SDP. On some
Android versions the friendly name may not be an empty string,
otherwise incoming connection requests are not fulfilled. The
<tt><i>port</i></tt> parameter is usually ignored and should be
specified as 0.
Z 7ad1e5d2a6621733477bd24b3ae900fc