Help Im Struggling

Topics: Bluetooth - Microsoft
Feb 8, 2016 at 8:17 AM
I have to do a barcode scanner wedge program but the scanners i need to interface to have a weird way of working.
  1. Create a bluetooth incoming comm port
  2. open new port
  3. scan a pairing barcode
  4. enter pin
  5. device creates 2 more com ports, incoming and outgoing
Now the problem is I am trying to get stage 1 working using the code
    private string GetBTMacAddress()  
        return br.LocalAddress.Nap.ToString("X") +br.LocalAddress.Sap.ToString("X");

    private void startCommunication()
    BluetoothAddress addr = BluetoothAddress.Parse( GetBTMacAddress());
    BluetoothDeviceInfo device = new BluetoothDeviceInfo(addr);
    bool state = true;

        device.SetServiceState(BluetoothService.SerialPort, state, true);            
But i get a NULL Exception on the above line.

Any clues and any one know of a good demo which will show the funcions I need.