Compartilhar via


PORTEMUPortParams (Compact 2013)

3/26/2014

This structure is used when registering a virtual COM port.

Syntax

typedef struct _portemu_port_params {
  int channel;
  int flocal;
  BT_ADDR device;
  int imtu;
  int iminmtu;
  int imaxmtu;
  int isendquota;
  int irecvquota;
  GUID uuidService;
  unsigned int uiportflags;
} PORTEMUPortParams;

Members

  • channel
    Set to either an explicit server channel, or, for a server application that wants the server channel to be autobound, to RFCOMM_CHANNEL_MULTIPLE. Call the IOCTL, IOCTL_BLUETOOTH_GET_RFCOMM_CHANNEL to determine which channel was assigned.
  • flocal
    Set to TRUE for a server port that accepts connections, or to FALSE for a client port that is used to creating outgoing connections.
  • device
    The BT_ADDR of a target device on a client port. BT_ADDR is defined in Ws2bth.h:

    typedef ULONGLONG bt_addr, *pbt_addr, BT_ADDR, *PBT_ADDR;
    
  • imtu
    The suggested number for the maximum transmission unit (MTU) for a packet in negotiations on connect, iminmtu and imaxmtu define acceptable range of negotiation (if all 3 are 0, default will be used).
  • iminmtu
    Defines an acceptable range of negotiation.
  • imaxmtu
    Defines an acceptable range of negotiation.
  • isendquota
    Queue size on send. The WriteFile operation will block if isendquota is exceeded. If set to 0, the default setting is used.
  • irecvquota
    Queue size on receive. Flow control is used to prevent receiving more data than irecvquota. Incoming data is discarded if it exceeds this limit. If set to 0, the default setting is used.
  • uuidService
    Specifies the UUID for the target RFCOMM service. If channel == 0 for the client port, an SDP query is performed to determine the target channel id before the connection is made.
  • uiportflags
    Can be a combination of the following flags.

    • RFCOMM_PORT_FLAGS_REMOTE_DCB
    • RFCOMM_PORT_FLAGS_KEEP_DCD
    • RFCOMM_PORT_FLAGS_AUTHENTICATE
    • RFCOMM_PORT_FLAGS_ENCRYPT
    • RFCOMM_PORT_FLAGS_USE_SECURITY_LEVEL

Remarks

If RFCOMM_PORT_FLAGS_AUTHENTICATE and/or RFCOMM_PORT_FLAGS_ENCRYPT is set, authentication is performed and/or encryption is toggled at connection establishment.

If RFCOMM_PORT_FLAGS_USE_SECURITY_LEVEL is set, then RFCOMM_PORT_FLAGS_AUTHENTICATE is ignored. The security level (0-3) is set or read by using RFCOMM_PORT_FLAGS_SECURITY_LEVEL (0x70) and RFCOMM_PORT_FLAGS_SECURITY_LEVEL_BITPOS (4) values. RFCOMM_PORT_FLAGS_SECURITY_LEVEL has a value of 0x70 or b01110000. You can use it as a mask for the security level. For example you can use code similar to the following to set the security level in the uiportflags member.

Uiportflags |= ((Seclevel << RFCOMM_PORT_FLAGS_SECURITY_LEVEL_BITPOS) & RFCOMM_PORT_FLAGS_SECURITY_LEVEL);

If RFCOMM_PORT_FLAGS_REMOTE_DCB is set, the Get or SetCommState functions initiate RFCOMM "remote port negotiation" (RPN) command, otherwise a local copy of DCB is being operated on.

If RFCOMM_PORT_FLAGS_KEEP_DCD, the Data Carrier Detect (DCD) flag is raised on connection and kept up throughout. In a NULL-modem cable, DCD is paired with the Data Set Ready (DSR) signal and is always on.

The direct connection UNIMODEM function uses DCD to detect cable unplugging. If a peer does not keep this bit on throughout the connection, this flag may be used to have port emulation layer simulate the bit being on.

Requirements

Header

bt_api.h

See Also

Reference

Bluetooth Application Development Structures
BD_ADDR