Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/OTInquiry.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/opietooth2/OTInquiry.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTInquiry.cpp b/noncore/settings/networksettings2/opietooth2/OTInquiry.cpp index 8e94bbc..2bc63c7 100644 --- a/noncore/settings/networksettings2/opietooth2/OTInquiry.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTInquiry.cpp | |||
@@ -56,13 +56,13 @@ OTInquiry::OTInquiry( OTDriver * Drv ) : QObject( Drv ) { | |||
56 | OTInquiry::~OTInquiry() { | 56 | OTInquiry::~OTInquiry() { |
57 | stopInquiring(); | 57 | stopInquiring(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void OTInquiry::stopInquiring( void ) { | 60 | void OTInquiry::stopInquiring( void ) { |
61 | if( Socket ) { | 61 | if( Socket ) { |
62 | owarn << "Stop inquiry" << oendl; | 62 | odebug << "Stop inquiry" << oendl; |
63 | Driver->closeSocket(); | 63 | Driver->closeSocket(); |
64 | Socket = 0; | 64 | Socket = 0; |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | bool OTInquiry::inquire( double timeout, int numResponses, int lap) { | 68 | bool OTInquiry::inquire( double timeout, int numResponses, int lap) { |
@@ -72,13 +72,13 @@ bool OTInquiry::inquire( double timeout, int numResponses, int lap) { | |||
72 | cmdBuf[0] = lap & 0xFF; | 72 | cmdBuf[0] = lap & 0xFF; |
73 | cmdBuf[1] = (lap >> 8) & 0xFF; | 73 | cmdBuf[1] = (lap >> 8) & 0xFF; |
74 | cmdBuf[2] = (lap >> 16) & 0xFF; | 74 | cmdBuf[2] = (lap >> 16) & 0xFF; |
75 | cmdBuf[3] = max(0x01, min(0x30, int(timeout/1.28))); | 75 | cmdBuf[3] = max(0x01, min(0x30, int(timeout/1.28))); |
76 | cmdBuf[4] = (unsigned char)numResponses; | 76 | cmdBuf[4] = (unsigned char)numResponses; |
77 | 77 | ||
78 | owarn << "Send HCI inquiry command. wait for " << cmdBuf[3] << oendl; | 78 | odebug << "Send HCI inquiry command. wait for " << cmdBuf[3] << oendl; |
79 | 79 | ||
80 | Socket->sendCommand(0x01, 0x0001, cmdBuf); | 80 | Socket->sendCommand(0x01, 0x0001, cmdBuf); |
81 | 81 | ||
82 | int status; | 82 | int status; |
83 | 83 | ||
84 | if( Socket->readStatus(0x01, 0x0001, &status)) { | 84 | if( Socket->readStatus(0x01, 0x0001, &status)) { |
@@ -86,18 +86,18 @@ bool OTInquiry::inquire( double timeout, int numResponses, int lap) { | |||
86 | SuccessfullyStarted = true; | 86 | SuccessfullyStarted = true; |
87 | InquiryTimeoutTimer->start( int(1000*(timeout+1.0)), true); | 87 | InquiryTimeoutTimer->start( int(1000*(timeout+1.0)), true); |
88 | return true; | 88 | return true; |
89 | } | 89 | } |
90 | else { | 90 | else { |
91 | QString S =QString().sprintf( "%x", status ); | 91 | QString S =QString().sprintf( "%x", status ); |
92 | owarn << "OTInquiry::inquiry() failed: 0x" << S << oendl; | 92 | odebug << "OTInquiry::inquiry() failed: 0x" << S << oendl; |
93 | emit finished(); | 93 | emit finished(); |
94 | return false; | 94 | return false; |
95 | } | 95 | } |
96 | } else { | 96 | } else { |
97 | owarn << "OTInquiry::inquiry(): Timeout." << oendl; | 97 | odebug << "OTInquiry::inquiry(): Timeout." << oendl; |
98 | return false; | 98 | return false; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | bool OTInquiry::isInquiring() { | 102 | bool OTInquiry::isInquiring() { |
103 | return InquiryTimeoutTimer->isActive(); | 103 | return InquiryTimeoutTimer->isActive(); |
@@ -123,27 +123,27 @@ void OTInquiry::onPeerFound( OTPeer * Peer, bool IsNew ) { | |||
123 | void OTInquiry::slotInquiryTimeout() { | 123 | void OTInquiry::slotInquiryTimeout() { |
124 | emit error( tr( "Timeout while waiting for end of inquiry.") ); | 124 | emit error( tr( "Timeout while waiting for end of inquiry.") ); |
125 | } | 125 | } |
126 | 126 | ||
127 | void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) { | 127 | void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) { |
128 | 128 | ||
129 | owarn << "OTInquiry: hci packet received: eventCode=" | 129 | odebug << "OTInquiry: hci packet received: eventCode=" |
130 | << (unsigned int)eventCode | 130 | << (unsigned int)eventCode |
131 | << " packetLength=" | 131 | << " packetLength=" |
132 | << (unsigned int)buf.size() | 132 | << (unsigned int)buf.size() |
133 | << oendl; | 133 | << oendl; |
134 | 134 | ||
135 | unsigned char *data = (unsigned char*)buf.data(); | 135 | unsigned char *data = (unsigned char*)buf.data(); |
136 | switch (eventCode) { | 136 | switch (eventCode) { |
137 | case EVT_INQUIRY_COMPLETE: | 137 | case EVT_INQUIRY_COMPLETE: |
138 | { unsigned char status = data[0]; | 138 | { unsigned char status = data[0]; |
139 | owarn << "EVT_INQUIRY_COMPLETE status=" << status << oendl; | 139 | odebug << "EVT_INQUIRY_COMPLETE status=" << status << oendl; |
140 | InquiryTimeoutTimer->stop(); | 140 | InquiryTimeoutTimer->stop(); |
141 | if (status == 0) { | 141 | if (status == 0) { |
142 | if( SuccessfullyStarted == true) { | 142 | if( SuccessfullyStarted == true) { |
143 | owarn << "OTInquiry ended successfully" << oendl; | 143 | odebug << "OTInquiry ended successfully" << oendl; |
144 | SuccessfullyEnded = true; | 144 | SuccessfullyEnded = true; |
145 | } | 145 | } |
146 | emit finished(); | 146 | emit finished(); |
147 | } | 147 | } |
148 | else { | 148 | else { |
149 | emit error( tr( "OTInquiry completed with error (code %1)" ). | 149 | emit error( tr( "OTInquiry completed with error (code %1)" ). |
@@ -160,13 +160,13 @@ void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) { | |||
160 | 160 | ||
161 | inquiry_info *results = (inquiry_info*)(data+1); | 161 | inquiry_info *results = (inquiry_info*)(data+1); |
162 | 162 | ||
163 | for (int n=0; n<numResults; n++) { | 163 | for (int n=0; n<numResults; n++) { |
164 | Addr.setBDAddr( results[n].bdaddr ); | 164 | Addr.setBDAddr( results[n].bdaddr ); |
165 | 165 | ||
166 | owarn << "INQUIRY_RESULT: " | 166 | odebug << "INQUIRY_RESULT: " |
167 | << Addr.toString() | 167 | << Addr.toString() |
168 | << oendl; | 168 | << oendl; |
169 | 169 | ||
170 | P = Driver->gateway()->findPeer( Addr ); | 170 | P = Driver->gateway()->findPeer( Addr ); |
171 | 171 | ||
172 | if( P ) { | 172 | if( P ) { |
@@ -200,13 +200,13 @@ void OTInquiry::slotHCIEvent(unsigned char eventCode, QByteArray buf) { | |||
200 | } | 200 | } |
201 | break; | 201 | break; |
202 | case EVT_CMD_STATUS : | 202 | case EVT_CMD_STATUS : |
203 | { int status = data[0]; | 203 | { int status = data[0]; |
204 | int numHciCmdPkts = data[1]; | 204 | int numHciCmdPkts = data[1]; |
205 | int cmdOpcode = *((uint16_t*)(data+2)); | 205 | int cmdOpcode = *((uint16_t*)(data+2)); |
206 | owarn << "EVT_CMD_STATUS status=" | 206 | odebug << "EVT_CMD_STATUS status=" |
207 | << status | 207 | << status |
208 | << " numPkts=" | 208 | << " numPkts=" |
209 | << numHciCmdPkts | 209 | << numHciCmdPkts |
210 | << " cmdOpcode=" | 210 | << " cmdOpcode=" |
211 | << cmdOpcode | 211 | << cmdOpcode |
212 | << oendl; | 212 | << oendl; |