summaryrefslogtreecommitdiffstats
path: root/hcid/security.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-02-08 03:20:03 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-02-08 03:20:03 +0000
commitc5f81f1139c33eccc59146d45893c8037d63e94f (patch)
treed7ea60cae20cdc918a959a72f2808199426a7c31 /hcid/security.c
parenta1018ae90706783c45c1c3814af3354b4b5504c8 (diff)
Add support for last seen information
Diffstat (limited to 'hcid/security.c')
-rw-r--r--hcid/security.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/hcid/security.c b/hcid/security.c
index f4b46bfe..c3c8caeb 100644
--- a/hcid/security.c
+++ b/hcid/security.c
@@ -38,6 +38,7 @@
#include <signal.h>
#include <syslog.h>
#include <time.h>
+#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@@ -422,6 +423,17 @@ static inline void inquiry_complete(int dev, bdaddr_t *sba, void *ptr)
hcid_dbus_inquiry_complete(sba);
}
+static inline void update_lastseen(bdaddr_t *sba, bdaddr_t *dba)
+{
+ time_t t;
+ struct tm *tm;
+
+ t = time(NULL);
+ tm = gmtime(&t);
+
+ write_lastseen_info(sba, dba, tm);
+}
+
static inline void inquiry_result(int dev, bdaddr_t *sba, int plen, void *ptr)
{
uint8_t num = *(uint8_t *) ptr++;
@@ -435,6 +447,8 @@ static inline void inquiry_result(int dev, bdaddr_t *sba, int plen, void *ptr)
hcid_dbus_inquiry_result(sba, &info->bdaddr, class, 0);
+ update_lastseen(sba, &info->bdaddr);
+
ptr += INQUIRY_INFO_SIZE;
}
}
@@ -457,6 +471,8 @@ static inline void inquiry_result_with_rssi(int dev, bdaddr_t *sba, int plen, vo
hcid_dbus_inquiry_result(sba, &info->bdaddr,
class, info->rssi);
+ update_lastseen(sba, &info->bdaddr);
+
ptr += INQUIRY_INFO_WITH_RSSI_AND_PSCAN_MODE_SIZE;
}
} else {
@@ -469,6 +485,8 @@ static inline void inquiry_result_with_rssi(int dev, bdaddr_t *sba, int plen, vo
hcid_dbus_inquiry_result(sba, &info->bdaddr,
class, info->rssi);
+ update_lastseen(sba, &info->bdaddr);
+
ptr += INQUIRY_INFO_WITH_RSSI_SIZE;
}
}
@@ -487,6 +505,8 @@ static inline void extended_inquiry_result(int dev, bdaddr_t *sba, int plen, voi
hcid_dbus_inquiry_result(sba, &info->bdaddr, class, info->rssi);
+ update_lastseen(sba, &info->bdaddr);
+
ptr += EXTENDED_INQUIRY_INFO_SIZE;
}
}