equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the Qt Mobility Components. |
7 ** This file is part of the Qt Mobility Components. |
8 ** |
8 ** |
51 |
51 |
52 if (!m_initDone) { |
52 if (!m_initDone) { |
53 initSensor<ProximitySensorChannelInterface>("proximitysensor"); |
53 initSensor<ProximitySensorChannelInterface>("proximitysensor"); |
54 |
54 |
55 if (m_sensorInterface) |
55 if (m_sensorInterface) |
56 QObject::connect(static_cast<ProximitySensorChannelInterface*>(m_sensorInterface), SIGNAL(dataAvailable(const int&)), this, SLOT(slotDataAvailable(const int&))); |
56 QObject::connect(static_cast<ProximitySensorChannelInterface*>(m_sensorInterface), SIGNAL(dataAvailable(const Unsigned&)), this, SLOT(slotDataAvailable(const Unsigned&))); |
57 else |
57 else |
58 qWarning() << "Unable to initialize proximity sensor."; |
58 qWarning() << "Unable to initialize proximity sensor."; |
59 |
59 |
60 // metadata |
60 // metadata |
61 addDataRate(2, 2); // 2Hz |
61 addDataRate(2, 2); // 2Hz |
65 |
65 |
66 m_initDone = true; |
66 m_initDone = true; |
67 } |
67 } |
68 } |
68 } |
69 |
69 |
70 void maemo6proximitysensor::slotDataAvailable(const int& data) |
70 void maemo6proximitysensor::slotDataAvailable(const Unsigned& data) |
71 { |
71 { |
72 bool close; |
72 bool close; |
73 if (data) |
73 if (data.x()) |
74 close = true; |
74 close = true; |
75 else |
75 else |
76 close = false; |
76 close = false; |
77 |
|
78 m_reading.setClose(close); |
77 m_reading.setClose(close); |
79 //m_reading.setTimestamp(data.timestamp()); |
78 m_reading.setTimestamp(data.UnsignedData().timestamp_); |
80 m_reading.setTimestamp(createTimestamp()); //TODO: use correct timestamp |
|
81 newReadingAvailable(); |
79 newReadingAvailable(); |
82 } |
80 } |