Connect Method
Connects to a remote service.
Syntax
ANSI (Cross Platform) int Connect(const char* lpszHost, int iPort); Unicode (Windows) INT Connect(LPCWSTR lpszHost, INT iPort);
#define MID_BTPORT_CONNECT 3 IPWORKSBT_EXTERNAL int IPWORKSBT_CALL IPWorksBT_BTPort_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);
Remarks
This method connects to a remote service. Calling this method is equivalent to setting the RemoteHost property to Host, setting RemotePort to Port, and then setting the Connected property to True.
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
Error Handling (C++)
This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)