IPWorks Bluetooth 2020 C++ Edition

Questions / Feedback?

BTPort Class

Properties   Methods   Events   Configuration Settings   Errors  

The BTPort class facilitates Bluetooth communications by providing an easy interface to system Bluetooth functions.

Syntax

BTPort

Remarks

The BTPort component provides a simple way to send and receive data over a Bluetooth socket. The first step is to establish a connection to a service. Connections are established by calling the Connect method.

Example (Connecting)


BTPort.Connect("20:C9:D0:94:3E:46", 10)

Alternatively, RemoteServiceClassId may be used instead of specifying a port. For instance:

        btport1.RemoteHost = "20:C9:D0:94:3E:46";
        btport1.RemoteServiceClassId = "00001101-0000-1000-8000-00805f9b34fb";
        btport1.Connected = true;

The Bluetooth Universally Unique Identifier (UUID) is in the form

00000000-0000-1000-8000-00805F9B34FB

To send data either set DataToSend, or call the Send, SendLine, or SendFile methods.

Received data will be fired through the DataIn event.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

AcceptDataEnables or disables data reception (the DataIn event).
BytesSentThe number of bytes actually sent after an assignment to DataToSend .
ConnectedTriggers a connection or disconnection.
DataToSendA string of data to be sent to the remote host.
EOLUsed to break the incoming data stream into chunks separated by EOL.
LocalHostThe address of the Bluetooth device through which connections are initiated or accepted.
LocalPortThe port in the Bluetooth device to which the class binds.
ProtocolThe Bluetooth protocol to be used.
RemoteHostThe Bluetooth address of the remote device.
RemotePortThe port on the remote Bluetooth device.
RemoteServiceClassIdThe class Id (UUID) of the remote service.
SingleLineModeSpecial mode for line-oriented protocols.
SSLAcceptServerCertEncodedThe certificate (PEM/base64 encoded).
SSLCertEncodedThe certificate (PEM/base64 encoded).
SSLCertStoreThe name of the certificate store for the client certificate.
SSLCertStorePasswordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
SSLCertStoreTypeThe type of certificate store for this certificate.
SSLCertSubjectThe subject of the certificate used for client authentication.
SSLEnabledWhether TLS/SSL is enabled.
SSLServerCertEncodedThe certificate (PEM/base64 encoded).
SSLStartModeDetermines how the class starts the SSL negotiation.
TimeoutA timeout for the class.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

ConfigSets or retrieves a configuration setting.
ConnectConnects to a remote service.
DisconnectDisconnects from the remote host.
DoEventsProcesses events from the internal message queue.
GetLineGets a line of text from the server.
InterruptInterrupts the current action.
SendSends data to the remote host.
SendFileSends file to the remote host.
SendLineSends a string followed by a newline.
StartSSLstarts SSL negotiation on a plaintext connection.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

ConnectedFired immediately after a connection completes (or fails).
ConnectionStatusFired to indicate changes in connection state.
DataInFired when data (complete lines) comes in.
DisconnectedFired when a connection is closed.
ErrorInformation about errors during data delivery.
ReadyToSendFired when the class is ready to send data.
SSLServerAuthenticationFired after the server presents its certificate to the client.
SSLStatusShows the progress of the secure connection.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

BTAuthenticateWhether authentication is required.
BTEncryptForces an encrypted connection if set to True.
BTMTUThe default RFCOMM MTU (Maximum Transmission Unit).
BTMTUMaxThe maximum RFCOMM MTU (Maximum Transmission Unit).
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks Bluetooth 2020 C++ Edition - Version 20.0 [Build 7941]