~ubuntu-branches/ubuntu/wily/qtconnectivity-opensource-src/wily

« back to all changes in this revision

Viewing changes to src/bluetooth/qbluetoothserviceinfo_qnx.cpp

  • Committer: Package Import Robot
  • Author(s): Lisandro Damián Nicanor Pérez Meyer, Timo Jyrinki
  • Date: 2014-02-23 00:01:49 UTC
  • mfrom: (0.1.3 experimental) (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140223000149-ht3k3x21dr5n5dol
Tags: 5.2.1-1
[ Timo Jyrinki ]
* New upstream release
* Move mkspecs to the new location
* Make private headers cleaning non version specific
* Add examples package
* Add dependencies to build against the 5.2.1 versions

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include "qbluetoothserviceinfo.h"
43
43
#include "qbluetoothserviceinfo_p.h"
44
44
 
45
 
#include "qrfcommserver_p.h"
46
 
#include "qrfcommserver.h"
 
45
#include "qbluetoothserver_p.h"
 
46
#include "qbluetoothserver.h"
47
47
 
48
 
QT_BEGIN_NAMESPACE_BLUETOOTH
 
48
QT_BEGIN_NAMESPACE
49
49
 
50
50
QBluetoothServiceInfoPrivate::QBluetoothServiceInfoPrivate()
51
51
:  registered(false)
54
54
 
55
55
QBluetoothServiceInfoPrivate::~QBluetoothServiceInfoPrivate()
56
56
{
57
 
    ppsUnregisterControl(0);
58
57
}
59
58
 
60
59
bool QBluetoothServiceInfoPrivate::isRegistered() const
62
61
    return registered;
63
62
}
64
63
 
65
 
bool QBluetoothServiceInfoPrivate::unregisterService() const
 
64
bool QBluetoothServiceInfoPrivate::unregisterService()
66
65
{
67
66
    if (!registered)
68
67
        return false;
70
69
    return false;
71
70
}
72
71
 
73
 
 
74
 
void QBluetoothServiceInfoPrivate::setRegisteredAttribute(quint16 attributeId, const QVariant &value) const
75
 
{
76
 
    Q_UNUSED(attributeId);
77
 
    Q_UNUSED(value);
78
 
 
79
 
    registerService();
80
 
}
81
 
 
82
 
void QBluetoothServiceInfoPrivate::removeRegisteredAttribute(quint16 attributeId) const
83
 
{
84
 
    Q_UNUSED(attributeId);
85
 
    registered = false;
86
 
}
87
 
 
88
 
extern QHash<QRfcommServerPrivate*, int> __fakeServerPorts;
89
 
 
90
 
bool QBluetoothServiceInfoPrivate::registerService() const
91
 
{
92
 
    Q_Q(const QBluetoothServiceInfo);
93
 
    if (q->socketProtocol() != QBluetoothServiceInfo::RfcommProtocol) {
94
 
        qWarning() << Q_FUNC_INFO << "Only SPP services can be registered on QNX";
 
72
extern QHash<QBluetoothServerPrivate*, int> __fakeServerPorts;
 
73
 
 
74
bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress& localAdapter)
 
75
{
 
76
    Q_UNUSED(localAdapter); //QNX always uses default local adapter
 
77
    if (protocolDescriptor(QBluetoothUuid::Rfcomm).isEmpty()) {
 
78
        qCWarning(QT_BT_QNX) << Q_FUNC_INFO << "Only SPP services can be registered on QNX";
95
79
        return false;
96
80
    }
97
81
 
98
 
    if (q->serverChannel() == -1)
 
82
    if (serverChannel() == -1)
99
83
        return false;
100
84
 
101
 
    if (__fakeServerPorts.key(q->serverChannel()) != 0) {
102
 
        qBBBluetoothDebug() << "Registering server with UUID" <<
103
 
                               q->serviceUuid() << " Name" << q->serviceName();
104
 
        qDebug() << "Server is" << __fakeServerPorts.key(q->serverChannel());
105
 
        if (!ppsSendControlMessage("register_server", 0x1101, q->serviceUuid(), QString(), q->serviceName(),
106
 
                              __fakeServerPorts.key(q->serverChannel()), BT_SPP_SERVER_SUBTYPE))
 
85
    if (__fakeServerPorts.key(serverChannel()) != 0) {
 
86
        if (!ppsSendControlMessage("register_server", 0x1101, attributes.value(QBluetoothServiceInfo::ServiceId).value<QBluetoothUuid>(), QString(),
 
87
                                   attributes.value(QBluetoothServiceInfo::ServiceName).toString(),
 
88
                              __fakeServerPorts.key(serverChannel()), BT_SPP_SERVER_SUBTYPE))
107
89
            return false;
108
90
        //The server needs to know the service name for the socket mount point path
109
 
        __fakeServerPorts.key(q->serverChannel())->m_serviceName = q->serviceName();
 
91
        __fakeServerPorts.key(serverChannel())->m_serviceName = attributes.value(QBluetoothServiceInfo::ServiceName).toString();
110
92
    } else {
111
93
        return false;
112
94
    }
115
97
    return true;
116
98
}
117
99
 
118
 
QT_END_NAMESPACE_BLUETOOTH
 
100
QT_END_NAMESPACE