ArduinoBTController::~ArduinoBTController()
{

    int closeFD = m_sppDataThread.getFD();
    m_sppDataThread.resetFD();
    bt_spp_close(closeFD);

    int errorCode;
    errorCode = bt_spp_deinit();
    qDebug() << "bt_spp_deinit" << errorCode;



}
void QBluetoothSocketPrivate::abort()
{
    Q_Q(QBluetoothSocket);
    qCDebug(QT_BT_QNX) << "Disconnecting service";
#ifdef QT_QNX_BT_BLUETOOTH
    if (isServerSocket)
        bt_spp_close_server(m_uuid.toString().toUtf8().data());
    else
        bt_spp_close(socket);
#else
    if (q->state() != QBluetoothSocket::ClosingState)
        ppsSendControlMessage("disconnect_service", 0x1101, m_uuid, m_peerAddress.toString(), QString(), 0,
                          isServerSocket ? BT_SPP_SERVER_SUBTYPE : BT_SPP_CLIENT_SUBTYPE);
#endif
    delete readNotifier;
    readNotifier = 0;
    delete connectWriteNotifier;
    connectWriteNotifier = 0;

    ::close(socket);

    isServerSocket = false;
}