diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index 7108446..63f9e85 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -17,6 +17,7 @@ MANPAGES = \ dc_descriptor_get_model.3 \ dc_descriptor_get_product.3 \ dc_descriptor_get_vendor.3 \ + dc_descriptor_get_transports.3 \ dc_descriptor_iterator.3 \ dc_device_close.3 \ dc_device_foreach.3 \ @@ -32,7 +33,29 @@ MANPAGES = \ dc_parser_new.3 \ dc_parser_samples_foreach.3 \ dc_parser_set_data.3 \ - libdivecomputer.3 + dc_bluetooth_open.3 \ + dc_bluetooth_iterator_new.3 \ + dc_bluetooth_device_get_address.3 \ + dc_bluetooth_device_get_name.3 \ + dc_bluetooth_addr2str.3 \ + dc_bluetooth_str2addr.3 \ + dc_bluetooth_device_free.3 \ + dc_usbhid_open.3 \ + dc_usbhid_device_get_pid.3 \ + dc_usbhid_device_get_vid.3 \ + dc_usbhid_iterator_new.3 \ + dc_usbhid_device_free.3 \ + dc_serial_open.3 \ + dc_serial_device_get_name.3 \ + dc_serial_iterator_new.3 \ + dc_serial_device_free.3 \ + dc_irda_open.3 \ + dc_irda_device_get_name.3 \ + dc_irda_device_get_address.3 \ + dc_irda_iterator_new.3 \ + dc_irda_device_free.3 \ + dc_iostream_close.3 \ + libdivecomputer.3 HTMLPAGES = $(MANPAGES:%=%.html) diff --git a/doc/man/dc_bluetooth_addr2str.3 b/doc/man/dc_bluetooth_addr2str.3 new file mode 100644 index 0000000..ea073c3 --- /dev/null +++ b/doc/man/dc_bluetooth_addr2str.3 @@ -0,0 +1,61 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_BLUETOOTH_ADDR2STR 3 +.Os +.Sh NAME +.Nm dc_bluetooth_addr2str +.Nd Convert a bluetooth address to a string. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/bluetooth.h +.Ft "const char*" +.Fo dc_bluetooth_addr2str +.Fa "dc_bluetooth_address_t address" +.Fa "char *str" +.Fa "size_t size" +.Fc +.Sh DESCRIPTION +Convert a bluetooth address to a string. +.Pp +The bluetooth address is formatted as XX:XX:XX:XX:XX:XX, where each XX is a +hexadecimal number specifying an octet of the 48-bit address. +The minimum size for the buffer is +.Dv DC_BLUETOOTH_SIZE +bytes. +.Pp +The reverse can be done with +.Xr dc_bluetooth_str2addr 3 . +.Sh RETURN VALUES +Returns the bluetooth address represented as a string. +.Sh SEE ALSO +.Xr dc_bluetooth_str2addr 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_bluetooth_device_free.3 b/doc/man/dc_bluetooth_device_free.3 new file mode 100644 index 0000000..fd29096 --- /dev/null +++ b/doc/man/dc_bluetooth_device_free.3 @@ -0,0 +1,52 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_BLUETOOTH_DEVICE_FREE 3 +.Os +.Sh NAME +.Nm dc_bluetooth_device_free +.Nd Destroy the bluetooth device and free all resources. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/bluetooth.h +.Ft void +.Fo dc_bluetooth_device_free +.Fa "dc_bluetooth_device_t *device" +.Fc +.Sh DESCRIPTION +Destroy the bluetooth device and free all resources. +The bluetooth +.Fa device +usually found by searching through +.Xr dc_bluetooth_iterator_new 3 . +.Sh SEE ALSO +.Xr dc_bluetooth_iterator_new 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_bluetooth_device_get_address.3 b/doc/man/dc_bluetooth_device_get_address.3 new file mode 100644 index 0000000..c7c1c63 --- /dev/null +++ b/doc/man/dc_bluetooth_device_get_address.3 @@ -0,0 +1,69 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_BLUETOOTH_DEVICE_GET_ADDRESS 3 +.Os +.Sh NAME +.Nm dc_bluetooth_device_get_address +.Nd Get the address of a bluetooth device. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/bluetooth.h +.Ft "dc_bluetooth_address_t" +.Fo dc_bluetooth_device_get_address +.Fa "dc_bluetooth_device_t *device" +.Fc +.Sh DESCRIPTION +Get the bluetooth device address of given bluetooth +.Fa device . +Required when opening transport communication with +.Xr dc_bluetooth_open 3 . +Requires a valid +.Fa device +of type +.Ft dc_bluetooth_device_t +which can be retrieved using +.Xr dc_bluetooth_iterator_new 3 . +.Sh RETURN VALUES +Returns the bluetooth address of +.Fa device +as +.Ft dc_bluetooth_address_t +which is a 64bit integer holding the bluetooth address. + +The address can be formatted as a string by using +.Xr dc_bluetooth_addr2str 3 . +.Sh SEE ALSO +.Xr dc_bluetooth_open 3 , +.Xr dc_bluetooth_iterator_new 3 , +.Xr dc_bluetooth_device_get_name 3 , +.Xr dc_bluetooth_addr2str 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_bluetooth_device_get_name.3 b/doc/man/dc_bluetooth_device_get_name.3 new file mode 100644 index 0000000..c7f7da6 --- /dev/null +++ b/doc/man/dc_bluetooth_device_get_name.3 @@ -0,0 +1,61 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_BLUETOOTH_DEVICE_GET_NAME 3 +.Os +.Sh NAME +.Nm dc_bluetooth_device_get_name +.Nd Get the name of a bluetooth device. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/bluetooth.h +.Ft "const char *" +.Fo dc_bluetooth_device_get_name +.Fa "dc_bluetooth_device_t *device" +.Fc +.Sh DESCRIPTION +Get the name of given bluetooth +.Fa device . +Used for displaying. +Requires a valid +.Fa bluetooth_device +of type +.Ft dc_bluetooth_device_t +which can be retrieved using +.Xr dc_bluetooth_iterator_new 3 . +.Sh RETURN VALUES +Returns the bluetooth device of +.Fa device . +.Sh SEE ALSO +.Xr dc_bluetooth_open 3 , +.Xr dc_bluetooth_iterator_new 3 , +.Xr dc_bluetooth_device_get_address 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_bluetooth_iterator_new.3 b/doc/man/dc_bluetooth_iterator_new.3 new file mode 100644 index 0000000..e532206 --- /dev/null +++ b/doc/man/dc_bluetooth_iterator_new.3 @@ -0,0 +1,102 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_BLUETOOTH_ITERATOR_NEW 3 +.Os +.Sh NAME +.Nm dc_bluetooth_iterator_new +.Nd Create an iterator to enumerate the bluetooth devices. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/bluetooth.h +.Ft dc_status_t +.Fo dc_bluetooth_iterator_new +.Fa "dc_iterator_t **iterator" +.Fa "dc_context_t *context" +.Fa "dc_descriptor_t *descriptor" +.Fc +.Sh DESCRIPTION +Iterates through the available bluetooth devices which matches the given +.Fa descriptor . +Accepts a +.Fa context +opened with +.Xr dc_context_new 3 +and a +.Fa descriptor +usually found by searching through +.Xr dc_descriptor_iterator 3 . +.Pp +On returning +.Dv DC_STATUS_SUCCESS +the +.Fa iterator +will be set to an +.Ft dc_iterator_t +which can be used to iterate the available bluetooth devices using +.Xr dc_iterator_next 3 . +.Pp +The value type of the iterator is of type +.Ft dc_bluetooth_device_t . +This value can be used in functions to extract information about this specific bluetooth device, namely +.Xr dc_bluetooth_device_get_name 3 +and +.Xr dc_bluetooth_device_get_address 3 . +When done the bluetooth device needs to be freed with +.Xr dc_bluetooth_device_free 3 . +.Pp +After iterating the +.Fa iterator +needs to be freed using +.Xr dc_iterator_free 3 . + +.Sh RETURN VALUES +Returns +.Dv DC_STATUS_SUCCESS +on success, or another +.Ft dc_status_t +code on failure. + +On +.Dv DC_STATUS_SUCCESS +the returned +.Fa iterator +needs to be freed when done using +.Xr dc_iterator_free 3 . +.Sh SEE ALSO +.Xr dc_context_new 3 , +.Xr dc_usbhid_iterator_new 3 , +.Xr dc_serial_iterator_new 3 , +.Xr dc_irda_iterator_new 3 , +.Xr dc_bluetooth_device_get_name 3 , +.Xr dc_bluetooth_device_get_address 3 , +.Xr dc_bluetooth_device_free 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_bluetooth_open.3 b/doc/man/dc_bluetooth_open.3 new file mode 100644 index 0000000..6764ece --- /dev/null +++ b/doc/man/dc_bluetooth_open.3 @@ -0,0 +1,87 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_BLUETOOTH_OPEN 3 +.Os +.Sh NAME +.Nm dc_bluetooth_open +.Nd Opens an iostream for a bluetooth device +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/bluetooth.h +.Ft dc_status_t +.Fo dc_bluetooth_open +.Fa "dc_iostream_t **iostream" +.Fa "dc_context_t *context" +.Fa "dc_bluetooth_address_t address" +.Fa "unsigned int port" +.Fc +.Sh DESCRIPTION +Opens an iostream for a bluetooth device. +Accepts a +.Fa context +opened with +.Xr dc_context_new 3 , +a 48-bit bluetooth +.Fa address +given by +.Xr dc_bluetooth_iterator_new 3 +together with +.Xr dc_bluetooth_device_get_address 3 +or +.Xr dc_bluetooth_str2addr 3 +and a bluetooth rfcomm +.Fa port +number (use 0 for autodetection). +.Pp +Upon returning +.Dv DC_STATUS_SUCCESS , +the +.Fa iostream +pointer must be freed with +.Xr dc_iostream_close 3 . +.Sh RETURN VALUES +Returns +.Dv DC_STATUS_SUCCESS +on success or one of several error values on error. +On success, the +.Fa iostream +pointer is filled in with an open handle. +.Sh SEE ALSO +.Xr dc_context_new 3 , +.Xr dc_iostream_close 3 , +.Xr dc_serial_open 3 , +.Xr dc_irda_open 3 , +.Xr dc_usbhid_open 3 , +.Xr dc_bluetooth_iterator_new 3 , +.Xr dc_bluetooth_device_get_address 3 , +.Xr dc_bluetooth_str2addr 3 , +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_bluetooth_str2addr.3 b/doc/man/dc_bluetooth_str2addr.3 new file mode 100644 index 0000000..19ad357 --- /dev/null +++ b/doc/man/dc_bluetooth_str2addr.3 @@ -0,0 +1,58 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_BLUETOOTH_STR2ADDR 3 +.Os +.Sh NAME +.Nm dc_bluetooth_str2addr +.Nd Convert a string to a bluetooth address. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/bluetooth.h +.Ft "dc_bluetooth_address_t" +.Fo dc_bluetooth_addr2str +.Fa "const char *address" +.Fc +.Sh DESCRIPTION +Convert a string to a bluetooth address. +.Pp +The string +.Fa address +is expected to be in the format XX:XX:XX:XX:XX:XX, +where each XX is a hexadecimal number specifying an octet of the 48-bit address. +.Pp +The reverse can be done with +.Xr dc_bluetooth_addr2str 3 . +.Sh RETURN VALUES +Returns the bluetooth address represented as a 48-bit number. +.Sh SEE ALSO +.Xr dc_bluetooth_addr2str 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_descriptor_get_transports.3 b/doc/man/dc_descriptor_get_transports.3 new file mode 100644 index 0000000..93bef41 --- /dev/null +++ b/doc/man/dc_descriptor_get_transports.3 @@ -0,0 +1,72 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_DESCRIPTOR_GET_TRANSPORTS 3 +.Os +.Sh NAME +.Nm dc_descriptor_get_transports +.Nd Gets the transports supported by the given descriptor. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/descriptor.h +.Ft "unsigned int" +.Fo dc_descriptor_get_transports +.Fa "dc_descriptor_t *descriptor" +.Fc +.Sh DESCRIPTION +Gets the transports supported by the given +.Fa descriptor . +The +.Fa descriptor +usually found by searching through +.Xr dc_descriptor_iterator 3 . +.Sh RETURN VALUES +Returns a union (bitwise OR) of the transports supported by the given +.Fa descriptor . +.Pp +The result is combination of +.Dv DC_TRANSPORT_USB , +.Dv DC_TRANSPORT_USBHID , +.Dv DC_TRANSPORT_BLE , +.Dv DC_TRANSPORT_BLUETOOTH , +.Dv DC_TRANSPORT_SERIAL , +.Dv DC_TRANSPORT_IRDA +.Pp +To determine if a specific transport is supported use the following code +.Bd -literal -offset indent +unsigned int transports = dc_descriptor_get_transports(descriptor); +if(transports & DC_TRANSPORT_USBHID) { + // Device supports USB HID as transport +} +.Ed +.Sh SEE ALSO +.Xr dc_descriptor_iterator 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_device_open.3 b/doc/man/dc_device_open.3 index 265d129..3ba335f 100644 --- a/doc/man/dc_device_open.3 +++ b/doc/man/dc_device_open.3 @@ -18,7 +18,7 @@ .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, .\" MA 02110-1301 USA .\" -.Dd January 5, 2017 +.Dd June 5, 2020 .Dt DC_DEVICE_OPEN 3 .Os .Sh NAME @@ -33,7 +33,7 @@ .Fa "dc_device_t **device" .Fa "dc_context_t *context" .Fa "dc_descriptor_t *descriptor" -.Fa "const char *name" +.Fa "dc_iostream_t *iostream" .Fc .Sh DESCRIPTION Open a dive computer device for processing. @@ -45,19 +45,14 @@ a dive computer .Fa descriptor usually found by searching through .Xr dc_descriptor_iterator 3 , -and a platform-specific device -.Fa name -.Po -such as -.Pa /dev/ttyUSBx -on Linux, -.Pa /dev/tty.xxx -on Mac OS X, -.Pa /dev/ttyUx -on the BSDs, +and a +.Fa iostream +opened with a transport specific open function like +.Xr dc_usbhid_open 3 , +.Xr dc_irda_open 3 , +.Xr dc_serial_open 3 , or -.Pa COMx -on Microsoft Windows +.Xr dc_bluetooth_open 3 .Pc . .Pp Upon returning @@ -83,6 +78,10 @@ The library was written by .An Jef Driesen , .Mt jef@libdivecomputer.org . +.br The manpages were written by .An Kristaps Dzonsons , .Mt kristaps@bsd.lv . +and +.An Vincent Hagen , +.Mt vinnie@script4web.nl \ No newline at end of file diff --git a/doc/man/dc_iostream_close.3 b/doc/man/dc_iostream_close.3 new file mode 100644 index 0000000..2f3b67b --- /dev/null +++ b/doc/man/dc_iostream_close.3 @@ -0,0 +1,60 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_IOSTREAM_CLOSE 3 +.Os +.Sh NAME +.Nm dc_iostream_close +.Nd Close the I/O stream and free all resources. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/iostream.h +.Ft dc_status_t +.Fo dc_iostream_close +.Fa "dc_iostream_t *iostream" +.Fc +.Sh DESCRIPTION +Close the I/O stream and free all resources. +Accepts the +.Fa iostream +to close and free. +.Sh RETURN VALUES +Returns +.Dv DC_STATUS_SUCCESS +on success, or another +.Ft dc_status_t +code on failure. +.Sh SEE ALSO +.Xr dc_usbhid_open 3 , +.Xr dc_serial_open 3 , +.Xr dc_irda_open 3 , +.Xr dc_bluetooth_open 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_irda_device_free.3 b/doc/man/dc_irda_device_free.3 new file mode 100644 index 0000000..bf0926f --- /dev/null +++ b/doc/man/dc_irda_device_free.3 @@ -0,0 +1,52 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_IRDA_DEVICE_FREE 3 +.Os +.Sh NAME +.Nm dc_irda_device_free +.Nd Destroy the irda device and free all resources. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/irda.h +.Ft void +.Fo dc_irda_device_free +.Fa "dc_irda_device_t *device" +.Fc +.Sh DESCRIPTION +Destroy the irda device and free all resources. +The irda +.Fa device +usually found by searching through +.Xr dc_irda_iterator_new 3 . +.Sh SEE ALSO +.Xr dc_irda_iterator_new 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_irda_device_get_address.3 b/doc/man/dc_irda_device_get_address.3 new file mode 100644 index 0000000..6cf4323 --- /dev/null +++ b/doc/man/dc_irda_device_get_address.3 @@ -0,0 +1,59 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_IRDA_DEVICE_GET_ADDRESS 3 +.Os +.Sh NAME +.Nm dc_irda_device_get_address +.Nd Get the address of the IrDA device. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/irda.h +.Ft "unsigned int" +.Fo dc_irda_device_get_address +.Fa "dc_irda_device_t *device" +.Fc +.Sh DESCRIPTION +Get the address of the IrDA device. Return value used for opening a IrDA device using +.Xr dc_irda_open 3 . +Requires a valid irda +.Fa device +of type +.Ft dc_irda_device_t +which can be retrieved using +.Xr dc_irda_iterator_new 3 . +.Sh RETURN VALUES +Returns the IrDA address of given IrDA +.Fa device +.Sh SEE ALSO +.Xr dc_irda_open 3 , +.Xr dc_irda_device_get_name 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_irda_device_get_name.3 b/doc/man/dc_irda_device_get_name.3 new file mode 100644 index 0000000..942ea6d --- /dev/null +++ b/doc/man/dc_irda_device_get_name.3 @@ -0,0 +1,58 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_IRDA_DEVICE_GET_NAME 3 +.Os +.Sh NAME +.Nm dc_irda_device_get_name +.Nd Get the address of the IrDA device. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/irda.h +.Ft "const char *" +.Fo dc_irda_device_get_name +.Fa "dc_irda_device_t *device" +.Fc +.Sh DESCRIPTION +Get the name of the IrDA device. Used for displaying. +Requires a valid irda +.Fa device +of type +.Ft dc_irda_device_t +which can be retrieved using +.Xr dc_irda_iterator_new 3 . +.Sh RETURN VALUES +Returns the IrDA name of given +.Fa irda_device +.Sh SEE ALSO +.Xr dc_irda_device_get_address 3 . +.Xr dc_irda_iterator_new 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_irda_iterator_new.3 b/doc/man/dc_irda_iterator_new.3 new file mode 100644 index 0000000..b24f73d --- /dev/null +++ b/doc/man/dc_irda_iterator_new.3 @@ -0,0 +1,102 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_IRDA_ITERATOR_NEW 3 +.Os +.Sh NAME +.Nm dc_irda_iterator_new +.Nd Create an iterator to enumerate the IrDA devices. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/irda.h +.Ft dc_status_t +.Fo dc_irda_iterator_new +.Fa "dc_iterator_t **iterator" +.Fa "dc_context_t *context" +.Fa "dc_descriptor_t *descriptor" +.Fc +.Sh DESCRIPTION +Iterates through the available IrDA devices which matches the given +.Fa descriptor . +Accepts a +.Fa context +opened with +.Xr dc_context_new 3 +and a +.Fa descriptor +usually found by searching through +.Xr dc_descriptor_iterator 3 . +.Pp +On returning +.Dv DC_STATUS_SUCCESS +the +.Fa iterator +will be set to an +.Ft dc_iterator_t +which can be used to iterate the available IrDA devices using +.Xr dc_iterator_next 3 . +.Pp +The value type of the iterator is of type +.Ft dc_irda_device_t . +This value can be used in functions to extract information about this specific IrDA device, namely +.Xr dc_irda_device_get_name 3 +and +.Xr dc_irda_device_get_address 3 . +When done the IrDA device needs to be freed with +.Xr dc_irda_device_free 3 . +.Pp +After iterating the +.Fa iterator +needs to be freed using +.Xr dc_iterator_free 3 . + +.Sh RETURN VALUES +Returns +.Dv DC_STATUS_SUCCESS +on success, or another +.Ft dc_status_t +code on failure. + +On +.Dv DC_STATUS_SUCCESS +the returned +.Fa iterator +needs to be freed when done using +.Xr dc_iterator_free 3 . +.Sh SEE ALSO +.Xr dc_context_new 3 , +.Xr dc_usbhid_iterator_new 3 , +.Xr dc_serial_iterator_new 3 , +.Xr dc_bluetooth_iterator_new 3 , +.Xr dc_irda_device_get_name 3 , +.Xr dc_irda_device_get_address 3 , +.Xr dc_irda_device_free 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_irda_open.3 b/doc/man/dc_irda_open.3 new file mode 100644 index 0000000..53d92df --- /dev/null +++ b/doc/man/dc_irda_open.3 @@ -0,0 +1,85 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_IRDA_OPEN 3 +.Os +.Sh NAME +.Nm dc_irda_open +.Nd Opens an iostream for a IrDA device +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/irda.h +.Ft dc_status_t +.Fo dc_irda_open +.Fa "dc_iostream_t **iostream" +.Fa "dc_context_t *context" +.Fa "unsigned int address" +.Fa "unsigned int lsap" +.Fc +.Sh DESCRIPTION +Opens an iostream for a IrDA (Infra Red) device. +Accepts a +.Fa context +opened with +.Xr dc_context_new 3 , +.Fa address +given through +.Xr dc_irda_iterator_new 3 +together with +.Xr dc_irda_device_get_address 3 +, the last argument +.Fa lsap +is a port number used during the communication. Currently only Uwatec computers use IrDA comminication and for those the +.Fa lsap +can be hardcoded to 1 +.Pp +Upon returning +.Dv DC_STATUS_SUCCESS , +the +.Fa iostream +pointer must be freed with +.Xr dc_iostream_close 3 . +.Sh RETURN VALUES +Returns +.Dv DC_STATUS_SUCCESS +on success or one of several error values on error. +On success, the +.Fa iostream +pointer is filled in with an open handle. +.Sh SEE ALSO +.Xr dc_context_new 3 , +.Xr dc_iostream_close 3 , +.Xr dc_serial_open 3 , +.Xr dc_usbhid_open 3 , +.Xr dc_bluetooth_open 3 , +.Xr dc_irda_iterator_new 3 , +.Xr dc_irda_device_get_address 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . \ No newline at end of file diff --git a/doc/man/dc_parser_get_field.3 b/doc/man/dc_parser_get_field.3 index 2b276a1..a4c33f2 100644 --- a/doc/man/dc_parser_get_field.3 +++ b/doc/man/dc_parser_get_field.3 @@ -149,7 +149,7 @@ the tank volume units as or .Dv DC_TANKVOLUME_METRIC ; .Va volume , -the tank volume in bar or zero if the tank is +the tank volume in litres or zero if the tank is .Dv DC_TANKVOLUME_NONE ; .Va workpressure , the work pressure in bar or zero if diff --git a/doc/man/dc_parser_samples_foreach.3 b/doc/man/dc_parser_samples_foreach.3 index 5a92011..5ac5554 100644 --- a/doc/man/dc_parser_samples_foreach.3 +++ b/doc/man/dc_parser_samples_foreach.3 @@ -126,7 +126,7 @@ Sets the .Fa rbt field. .It Dv DC_SAMPLE_HEARTBEAT -The diver's heartbeet in beats per minute. +The diver's heartbeat in beats per minute. Sets the .Fa heartbeat field. diff --git a/doc/man/dc_serial_device_free.3 b/doc/man/dc_serial_device_free.3 new file mode 100644 index 0000000..5ee78b5 --- /dev/null +++ b/doc/man/dc_serial_device_free.3 @@ -0,0 +1,52 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_SERIAL_DEVICE_FREE 3 +.Os +.Sh NAME +.Nm dc_serial_device_free +.Nd Destroy the serial device and free all resources. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/serial.h +.Ft void +.Fo dc_serial_device_free +.Fa "dc_serial_device_t *device" +.Fc +.Sh DESCRIPTION +Destroy the serial device and free all resources. +The serial +.Fa device +usually found by searching through +.Xr dc_serial_iterator_new 3 . +.Sh SEE ALSO +.Xr dc_serial_iterator_new 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_serial_device_get_name.3 b/doc/man/dc_serial_device_get_name.3 new file mode 100644 index 0000000..88c4e68 --- /dev/null +++ b/doc/man/dc_serial_device_get_name.3 @@ -0,0 +1,59 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_SERIAL_DEVICE_GET_NAME 3 +.Os +.Sh NAME +.Nm dc_serial_device_get_name +.Nd Get the device name of the serial device. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/serial.h +.Ft "const char *" +.Fo dc_serial_device_get_name +.Fa "dc_serial_device_t *device" +.Fc +.Sh DESCRIPTION +Get the device node of the serial device. Used when opening serial transport with +.Xr dc_serial_open 3 . +Requires a valid serial +.Fa device +of type +.Ft dc_serial_device_t +which can be retrieved using +.Xr dc_serial_iterator_new 3 . +.Sh RETURN VALUES +Returns the device name of given serial +.Fa device +.Sh SEE ALSO +.Xr dc_serial_open 3 , +.Xr dc_serial_iterator_new 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_serial_iterator_new.3 b/doc/man/dc_serial_iterator_new.3 new file mode 100644 index 0000000..91ad54c --- /dev/null +++ b/doc/man/dc_serial_iterator_new.3 @@ -0,0 +1,99 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_SERIAL_ITERATOR_NEW 3 +.Os +.Sh NAME +.Nm dc_serial_iterator_new +.Nd Create an iterator to enumerate the serial devices. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/serial.h +.Ft dc_status_t +.Fo dc_serial_iterator_new +.Fa "dc_iterator_t **iterator" +.Fa "dc_context_t *context" +.Fa "dc_descriptor_t *descriptor" +.Fc +.Sh DESCRIPTION +Iterates through the available serial devices matching the given +.Fa descriptor . +Accepts a +.Fa context +opened with +.Xr dc_context_new 3 +and a +.Fa descriptor +usually found by searching through +.Xr dc_descriptor_iterator 3 . +.Pp +On returning +.Dv DC_STATUS_SUCCESS +the +.Fa iterator +will be set to an +.Ft dc_iterator_t +which can be used to iterate the available serial devices using +.Xr dc_iterator_next 3 . +.Pp +The value type of the iterator is of type +.Ft dc_serial_device_t . +This value can be used in functions to extract information about this specific serial device, namely +.Xr dc_serial_device_get_name 3 +When done the serial device needs to be freed with +.Xr dc_serial_device_free 3 . +.Pp +After iterating the +.Fa iterator +needs to be freed using +.Xr dc_iterator_free 3 . + +.Sh RETURN VALUES +Returns +.Dv DC_STATUS_SUCCESS +on success, or another +.Ft dc_status_t +code on failure. + +On +.Dv DC_STATUS_SUCCESS +the returned +.Fa iterator +needs to be freed when done using +.Xr dc_iterator_free 3 . +.Sh SEE ALSO +.Xr dc_context_new 3 , +.Xr dc_usbhid_iterator_new 3 , +.Xr dc_irda_iterator_new 3 , +.Xr dc_bluetooth_iterator_new 3 , +.Xr dc_serial_device_get_name 3 , +.Xr dc_serial_device_free 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_serial_open.3 b/doc/man/dc_serial_open.3 new file mode 100644 index 0000000..df8547c --- /dev/null +++ b/doc/man/dc_serial_open.3 @@ -0,0 +1,80 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_SERIAL_OPEN 3 +.Os +.Sh NAME +.Nm dc_serial_open +.Nd Opens an iostream for a serial device +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/serial.h +.Ft dc_status_t +.Fo dc_serial_open +.Fa "dc_iostream_t **iostream" +.Fa "dc_context_t *context" +.Fa "const char *name" +.Fc +.Sh DESCRIPTION +Opens an iostream for a serial device. +Accepts a +.Fa context +opened with +.Xr dc_context_new 3 +and a +.Fa name +device name, usually found through +.Xr dc_serial_iterator_new 3 +with +.Xr dc_serial_device_get_name 3 . +.Pp +Upon returning +.Dv DC_STATUS_SUCCESS , +the +.Fa iostream +pointer must be freed with +.Xr dc_iostream_close 3 . +.Sh RETURN VALUES +Returns +.Dv DC_STATUS_SUCCESS +on success or one of several error values on error. +On success, the +.Fa iostream +pointer is filled in with an open handle. +.Sh SEE ALSO +.Xr dc_context_new 3 , +.Xr dc_iostream_close 3 , +.Xr dc_usbhid_open 3 , +.Xr dc_irda_open 3 , +.Xr dc_bluetooth_open 3 , +.Xr dc_serial_iterator_new 3 , +.Xr dc_serial_device_get_name 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_usbhid_device_free.3 b/doc/man/dc_usbhid_device_free.3 new file mode 100644 index 0000000..a4bb94a --- /dev/null +++ b/doc/man/dc_usbhid_device_free.3 @@ -0,0 +1,52 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_USBHID_DEVICE_FREE 3 +.Os +.Sh NAME +.Nm dc_usbhid_device_free +.Nd Destroy the USB HID device and free all resources. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/usbhid.h +.Ft void +.Fo dc_usbhid_device_free +.Fa "dc_usbhid_device_t *device" +.Fc +.Sh DESCRIPTION +Destroy the USB HID device and free all resources. +The usbhid +.Fa device +usually found by searching through +.Xr dc_usbhid_iterator_new 3 . +.Sh SEE ALSO +.Xr dc_usbhid_iterator_new 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_usbhid_device_get_pid.3 b/doc/man/dc_usbhid_device_get_pid.3 new file mode 100644 index 0000000..6a371c5 --- /dev/null +++ b/doc/man/dc_usbhid_device_get_pid.3 @@ -0,0 +1,58 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_USBHID_DEVICE_GET_PID 3 +.Os +.Sh NAME +.Nm dc_usbhid_device_get_pid +.Nd Get the product id (PID) of the USB HID device. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/usbhid.h +.Ft "unsigned int" +.Fo dc_usbhid_device_get_pid +.Fa "dc_usbhid_device_t *device" +.Fc +.Sh DESCRIPTION +Get the product id (PID) of the USB HID device. Used for displaying. +Requires a valid usbhid +.Fa device +of type +.Ft dc_usbhid_device_t +which can be retrieved using +.Xr dc_usbhid_iterator_new 3 . +.Sh RETURN VALUES +Returns the product id (PID) of given +.Fa usbhid_device +.Sh SEE ALSO +.Xr dc_usbhid_device_get_vid 3 , +.Xr dc_usbhid_iterator_new 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_usbhid_device_get_vid.3 b/doc/man/dc_usbhid_device_get_vid.3 new file mode 100644 index 0000000..e82ac53 --- /dev/null +++ b/doc/man/dc_usbhid_device_get_vid.3 @@ -0,0 +1,58 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_USBHID_DEVICE_GET_VID 3 +.Os +.Sh NAME +.Nm dc_usbhid_device_get_vid +.Nd Get the vendor id (VID) of the USB HID device. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/usbhid.h +.Ft "unsigned int" +.Fo dc_usbhid_device_get_vid +.Fa "dc_usbhid_device_t *device" +.Fc +.Sh DESCRIPTION +Get the vendor id (VID) of the USB HID device. Used for displaying. +Requires a valid usbhid +.Fa device +of type +.Ft dc_usbhid_device_t +which can be retrieved using +.Xr dc_usbhid_iterator_new 3 . +.Sh RETURN VALUES +Returns the vendor id (VID) of given usbhid +.Fa device +.Sh SEE ALSO +.Xr dc_usbhid_device_get_vid 3 , +.Xr dc_usbhid_iterator_new 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_usbhid_iterator_new.3 b/doc/man/dc_usbhid_iterator_new.3 new file mode 100644 index 0000000..0778d38 --- /dev/null +++ b/doc/man/dc_usbhid_iterator_new.3 @@ -0,0 +1,101 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_USBHID_ITERATOR_NEW 3 +.Os +.Sh NAME +.Nm dc_usbhid_iterator_new +.Nd Create an iterator to enumerate the USB HID devices. +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/usbhid.h +.Ft dc_status_t +.Fo dc_usbhid_iterator_new +.Fa "dc_iterator_t **iterator" +.Fa "dc_context_t *context" +.Fa "dc_descriptor_t *descriptor" +.Fc +.Sh DESCRIPTION +Iterates through the available USB HID devices matching the given +.Fa descriptor . +Accepts a +.Fa context +opened with +.Xr dc_context_new 3 +and a +.Fa descriptor +usually found by searching through +.Xr dc_descriptor_iterator 3 . +.Pp +On returning +.Dv DC_STATUS_SUCCESS +the +.Fa iterator +will be set to an +.Ft dc_iterator_t +which can be used to iterate the available USB HID devices using +.Xr dc_iterator_next 3 . +.Pp +The value type of the iterator is of type +.Ft dc_usbhid_device_t . +This value can be used in functions to extract information about this specific USB HID device, namely +.Xr dc_usbhid_device_get_pid 3 +and +.Xr dc_usbhid_device_get_vid 3 . +When done the USB HID device needs to be freed with +.Xr dc_usbhid_device_free 3 . +.Pp +After iterating the +.Fa iterator +needs to be freed using +.Xr dc_iterator_free 3 . + +.Sh RETURN VALUES +Returns +.Dv DC_STATUS_SUCCESS +on success, or another +.Ft dc_status_t +code on failure. + +On +.Dv DC_STATUS_SUCCESS +the returned +.Fa iterator +needs to be freed when done using +.Xr dc_iterator_free 3 . +.Sh SEE ALSO +.Xr dc_context_new 3 , +.Xr dc_bluetooth_iterator_new 3 , +.Xr dc_serial_iterator_new 3 , +.Xr dc_irda_iterator_new 3 , +.Xr dc_usbhid_device_get_pid 3 , +.Xr dc_usbhid_device_get_vid 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . diff --git a/doc/man/dc_usbhid_open.3 b/doc/man/dc_usbhid_open.3 new file mode 100644 index 0000000..e7dce39 --- /dev/null +++ b/doc/man/dc_usbhid_open.3 @@ -0,0 +1,77 @@ +.\" +.\" libdivecomputer +.\" +.\" Copyright (C) 2020 Vincent Hagen +.\" +.\" This library is free software; you can redistribute it and/or +.\" modify it under the terms of the GNU Lesser General Public +.\" License as published by the Free Software Foundation; either +.\" version 2.1 of the License, or (at your option) any later version. +.\" +.\" This library is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +.\" Lesser General Public License for more details. +.\" +.\" You should have received a copy of the GNU Lesser General Public +.\" License along with this library; if not, write to the Free Software +.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +.\" MA 02110-1301 USA +.\" +.Dd June 5, 2020 +.Dt DC_USBHID_OPEN 3 +.Os +.Sh NAME +.Nm dc_usbhid_open +.Nd Opens an iostream for a USB HID device +.Sh LIBRARY +.Lb libdivecomputer +.Sh SYNOPSIS +.In libdivecomputer/usbhid.h +.Ft dc_status_t +.Fo dc_usbhid_open +.Fa "dc_iostream_t **iostream" +.Fa "dc_context_t *context" +.Fa "dc_usbhid_device_t *device" +.Fc +.Sh DESCRIPTION +Opens an iostream for a USB HID device. +Accepts a +.Fa context +opened with +.Xr dc_context_new 3 +and a +.Fa device +usually found by searching through +.Xr dc_usbhid_iterator_new 3 . +.Pp +Upon returning +.Dv DC_STATUS_SUCCESS , +the +.Fa iostream +pointer must be freed with +.Xr dc_iostream_close 3 . +.Sh RETURN VALUES +Returns +.Dv DC_STATUS_SUCCESS +on success or one of several error values on error. +On success, the +.Fa iostream +pointer is filled in with an open handle. +.Sh SEE ALSO +.Xr dc_context_new 3 , +.Xr dc_usbhid_iterator_new 3 , +.Xr dc_iostream_close 3 , +.Xr dc_serial_open 3 , +.Xr dc_irda_open 3 , +.Xr dc_bluetooth_open 3 . +.Sh AUTHORS +The +.Lb libdivecomputer +library was written by +.An Jef Driesen , +.Mt jef@libdivecomputer.org . +.br +This manpage is written by +.An Vincent Hagen , +.Mt vinnie@script4web.nl . \ No newline at end of file diff --git a/doc/man/libdivecomputer.3 b/doc/man/libdivecomputer.3 index c85f140..4e1f601 100644 --- a/doc/man/libdivecomputer.3 +++ b/doc/man/libdivecomputer.3 @@ -41,9 +41,8 @@ these steps: .Bl -enum .It Create a new context with -.Xr dc_context_new 3 . -This supplies a parse context: logging, error handling, etc. -Override the values with +.Xr dc_context_new 3 +to initialize the library. Logging can be controlled with .Xr dc_context_set_logfunc 3 and .Xr dc_context_set_loglevel 3 . @@ -52,11 +51,28 @@ Find a descriptor for their dive computer by iterating through .Xr dc_descriptor_iterator 3 and searching by name, vendor, or product family. .It -Open the hardware device to which the dive computer is connected with -.Xr dc_device_open 3 , -then invoke +Find the transport to use for the communication. To determine the supported transports use +.Xr dc_descriptor_get_transports 3 . +.It +Find the hardware device corresponding to the connected dive computer by iterating through +.Xr dc_usbhid_iterator_new 3 , +.Xr dc_serial_iterator_new 3 , +.Xr dc_irda_iterator_new 3 +or +.Xr dc_bluetooth_iterator_new 3 . +.It +Open the transport communcations with +.Xr dc_usbhid_open 3 , +.Xr dc_serial_open 3 , +.Xr dc_irda_open 3 +or +.Xr dc_bluetooth_open 3 . +.It +Open a connection to the dive computer with +.Xr dc_device_open 3 . +Optionally use .Xr dc_device_set_events 3 , -.Xr dc_device_set_fingerprint 3 , +.Xr dc_device_set_fingerprint 3 and .Xr dc_device_set_cancel 3 to set the logging events, last-seen fingerprint, and cancel routine, @@ -71,8 +87,9 @@ and set the parsed data with .Xr dc_parser_set_data 3 . .It Get attributes of the parsed dive with -.Xr dc_parser_get_field 3 , -then iterate through the dive's samples (recorded data) with +.Xr dc_parser_get_field 3 . +.It +Iterate through the dive's samples (recorded data) with .Xr dc_parser_samples_foreach 3 . .El .Sh RETURN VALUES @@ -129,7 +146,10 @@ return .Dv DC_STATUS_SUCCESS . .El .Sh SEE ALSO -.Xr dc_buffer_new 3 +.Xr dc_context_new 3 , +.Xr dc_descriptor_iterator 3 +.Xr dc_device_open 3 +.Xr dc_parser_new 3 .Sh AUTHORS The .Lb libdivecomputer