Home > Language Reference > Classes > Bluetooth
CreatePiconet Method
Creates a piconet whose local device is the master.
Syntax
Public Sub CreatePiconet(ByVal bUnlockInbound As Boolean, ByVal bDiscoverable As Boolean)
| Parameter | Description |
| bUnlockInbound | Determines whether the created piconet will accept inbound connection or not. |
| bDiscoverable | Determine whether the device will be discoverable or not. |
Remarks
The CreatePiconet method creates a new piconet, the local device being the master. This method should not be called by a device which is already involved into an existing piconet, otherwise a runtime error occurs.
The bLock parameters indicates whether inbound connections will be accepted or not. Note that disabling inbound connections has no effect on outbound connections: the master will still be able to discover and connect to slaves.
The bDiscoverable parameters indicates whether the local device will be discoverable or not. If True, the radio will respond to inquiries. If False, the radio will be configured to be only connectable. In other words, only devices that know its Bluetooth address will be able to connect to it.
You can also alter the piconet configuration after it is created, by calling the LockInbound method.
This method internally calls the DoEvents function. This implies that any event (such as timers, menu and button clicks, etc) can be raised and processed while your code waits for this function to return. If necessary, you could use a boolean flag to avoid your application initiates another operation while the piconet is being created. For example:
Private bt As New Bluetooth
Private bPending As Boolean
Private Sub Button1_Click()
If Not bPending Then
bPending = True
bt.CreatePiconet True, True
bPending = False
End If
End Sub
Private Sub Button2_Click()
If Not bPending Then
bPending = True
bt.DestroyPiconet
bPending = False
End If
End Sub
Private Sub Form_KeyPress(ByRef iChar As Integer, ByRef iKeyCode As Integer, ByRef eModifiers As HbKeyModifier, ByRef bForward As Boolean)
If bPending then bForward = False
End SubThe BtWhiteboard sample illustrates how to use piconets with HB++.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | Requires a Bluetooth enabled device. |