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.
AcceptData | Enables or disables data reception (the DataIn event). |
BytesSent | The number of bytes actually sent after an assignment to DataToSend . |
Connected | Triggers a connection or disconnection. |
DataToSend | A string of data to be sent to the remote host. |
EOL | Used to break the incoming data stream into chunks separated by EOL. |
LocalHost | The address of the Bluetooth device through which connections are initiated or accepted. |
LocalPort | The port in the Bluetooth device to which the class binds. |
Protocol | The Bluetooth protocol to be used. |
RemoteHost | The Bluetooth address of the remote device. |
RemotePort | The port on the remote Bluetooth device. |
RemoteServiceClassId | The class Id (UUID) of the remote service. |
SingleLineMode | Special mode for line-oriented protocols. |
SSLAcceptServerCertEncoded | The certificate (PEM/base64 encoded). |
SSLCertEncoded | The certificate (PEM/base64 encoded). |
SSLCertStore | The name of the certificate store for the client certificate. |
SSLCertStorePassword | If 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. |
SSLCertStoreType | The type of certificate store for this certificate. |
SSLCertSubject | The subject of the certificate used for client authentication. |
SSLEnabled | Whether TLS/SSL is enabled. |
SSLServerCertEncoded | The certificate (PEM/base64 encoded). |
SSLStartMode | Determines how the class starts the SSL negotiation. |
Timeout | A 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.
Config | Sets or retrieves a configuration setting. |
Connect | Connects to a remote service. |
Disconnect | Disconnects from the remote host. |
DoEvents | Processes events from the internal message queue. |
GetLine | Gets a line of text from the server. |
Interrupt | Interrupts the current action. |
Send | Sends data to the remote host. |
SendFile | Sends file to the remote host. |
SendLine | Sends a string followed by a newline. |
StartSSL | starts 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.
Connected | Fired immediately after a connection completes (or fails). |
ConnectionStatus | Fired to indicate changes in connection state. |
DataIn | Fired when data (complete lines) comes in. |
Disconnected | Fired when a connection is closed. |
Error | Information about errors during data delivery. |
ReadyToSend | Fired when the class is ready to send data. |
SSLServerAuthentication | Fired after the server presents its certificate to the client. |
SSLStatus | Shows 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.
BTAuthenticate | Whether authentication is required. |
BTEncrypt | Forces an encrypted connection if set to True. |
BTMTU | The default RFCOMM MTU (Maximum Transmission Unit). |
BTMTUMax | The maximum RFCOMM MTU (Maximum Transmission Unit). |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
FirewallData | Used to send extra data to the firewall. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
ProcessIdleEvents | Whether the class uses its internal event loop to process events when the main thread is idle. |
SelectWaitMillis | The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process. |
UseInternalSecurityAPI | Tells the class whether or not to use the system security libraries or an internal implementation. |