Skip to content

Commit 369ea96

Browse files
Merge pull request #182 from Semper-Viventem/improve-gatt-service-recognision
Implement device services analysis
2 parents 4e245da + a5589fe commit 369ea96

35 files changed

+2361
-145
lines changed

app/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ android {
2626
minSdk = 29
2727
targetSdk = 35
2828

29-
versionCode = 1708536368
30-
versionName = "0.28.0-beta"
29+
versionCode = 1708536370
30+
versionName = "0.29.0-beta"
3131

3232
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3333

@@ -195,6 +195,9 @@ dependencies {
195195

196196
// tests
197197
testImplementation(libs.junit)
198+
testImplementation(libs.mockk)
199+
testImplementation(libs.ktx.testing)
200+
testImplementation(libs.ktx.testing.core)
198201
androidTestImplementation(libs.ktx.testing)
199202
}
200203

Lines changed: 351 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,351 @@
1+
{
2+
"formatVersion": 1,
3+
"database": {
4+
"version": 16,
5+
"identityHash": "f67e089b6e3087d11b72594e0d5290ea",
6+
"entities": [
7+
{
8+
"tableName": "device",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `name` TEXT, `last_detect_time_ms` INTEGER NOT NULL, `first_detect_time_ms` INTEGER NOT NULL, `detect_count` INTEGER NOT NULL, `custom_name` TEXT, `favorite` INTEGER NOT NULL, `manufacturer_id` INTEGER, `manufacturer_name` TEXT, `last_following_detection_ms` INTEGER, `tags` TEXT NOT NULL DEFAULT '', `last_seen_rssi` INTEGER, `system_address_type` INTEGER, `device_class` INTEGER, `is_paired` INTEGER NOT NULL, `service_uuids` TEXT NOT NULL DEFAULT '', `row_data_encoded` TEXT, PRIMARY KEY(`address`))",
10+
"fields": [
11+
{
12+
"fieldPath": "address",
13+
"columnName": "address",
14+
"affinity": "TEXT",
15+
"notNull": true
16+
},
17+
{
18+
"fieldPath": "name",
19+
"columnName": "name",
20+
"affinity": "TEXT",
21+
"notNull": false
22+
},
23+
{
24+
"fieldPath": "lastDetectTimeMs",
25+
"columnName": "last_detect_time_ms",
26+
"affinity": "INTEGER",
27+
"notNull": true
28+
},
29+
{
30+
"fieldPath": "firstDetectTimeMs",
31+
"columnName": "first_detect_time_ms",
32+
"affinity": "INTEGER",
33+
"notNull": true
34+
},
35+
{
36+
"fieldPath": "detectCount",
37+
"columnName": "detect_count",
38+
"affinity": "INTEGER",
39+
"notNull": true
40+
},
41+
{
42+
"fieldPath": "customName",
43+
"columnName": "custom_name",
44+
"affinity": "TEXT",
45+
"notNull": false
46+
},
47+
{
48+
"fieldPath": "favorite",
49+
"columnName": "favorite",
50+
"affinity": "INTEGER",
51+
"notNull": true
52+
},
53+
{
54+
"fieldPath": "manufacturerId",
55+
"columnName": "manufacturer_id",
56+
"affinity": "INTEGER",
57+
"notNull": false
58+
},
59+
{
60+
"fieldPath": "manufacturerName",
61+
"columnName": "manufacturer_name",
62+
"affinity": "TEXT",
63+
"notNull": false
64+
},
65+
{
66+
"fieldPath": "lastFollowingDetectionMs",
67+
"columnName": "last_following_detection_ms",
68+
"affinity": "INTEGER",
69+
"notNull": false
70+
},
71+
{
72+
"fieldPath": "tags",
73+
"columnName": "tags",
74+
"affinity": "TEXT",
75+
"notNull": true,
76+
"defaultValue": "''"
77+
},
78+
{
79+
"fieldPath": "lastSeenRssi",
80+
"columnName": "last_seen_rssi",
81+
"affinity": "INTEGER",
82+
"notNull": false
83+
},
84+
{
85+
"fieldPath": "systemAddressType",
86+
"columnName": "system_address_type",
87+
"affinity": "INTEGER",
88+
"notNull": false
89+
},
90+
{
91+
"fieldPath": "deviceClass",
92+
"columnName": "device_class",
93+
"affinity": "INTEGER",
94+
"notNull": false
95+
},
96+
{
97+
"fieldPath": "isPaired",
98+
"columnName": "is_paired",
99+
"affinity": "INTEGER",
100+
"notNull": true
101+
},
102+
{
103+
"fieldPath": "serviceUuids",
104+
"columnName": "service_uuids",
105+
"affinity": "TEXT",
106+
"notNull": true,
107+
"defaultValue": "''"
108+
},
109+
{
110+
"fieldPath": "rowDataEncoded",
111+
"columnName": "row_data_encoded",
112+
"affinity": "TEXT",
113+
"notNull": false
114+
}
115+
],
116+
"primaryKey": {
117+
"autoGenerate": false,
118+
"columnNames": [
119+
"address"
120+
]
121+
},
122+
"indices": [],
123+
"foreignKeys": []
124+
},
125+
{
126+
"tableName": "radar_profile",
127+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL, `description` TEXT, `is_active` INTEGER NOT NULL, `detect_filter` TEXT)",
128+
"fields": [
129+
{
130+
"fieldPath": "id",
131+
"columnName": "id",
132+
"affinity": "INTEGER",
133+
"notNull": false
134+
},
135+
{
136+
"fieldPath": "name",
137+
"columnName": "name",
138+
"affinity": "TEXT",
139+
"notNull": true
140+
},
141+
{
142+
"fieldPath": "description",
143+
"columnName": "description",
144+
"affinity": "TEXT",
145+
"notNull": false
146+
},
147+
{
148+
"fieldPath": "isActive",
149+
"columnName": "is_active",
150+
"affinity": "INTEGER",
151+
"notNull": true
152+
},
153+
{
154+
"fieldPath": "detectFilter",
155+
"columnName": "detect_filter",
156+
"affinity": "TEXT",
157+
"notNull": false
158+
}
159+
],
160+
"primaryKey": {
161+
"autoGenerate": true,
162+
"columnNames": [
163+
"id"
164+
]
165+
},
166+
"indices": [],
167+
"foreignKeys": []
168+
},
169+
{
170+
"tableName": "apple_contacts",
171+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`sha_256` INTEGER NOT NULL, `associated_address` TEXT NOT NULL, `first_detect_time_ms` INTEGER NOT NULL, `last_detect_time_ms` INTEGER NOT NULL, PRIMARY KEY(`sha_256`))",
172+
"fields": [
173+
{
174+
"fieldPath": "sha256",
175+
"columnName": "sha_256",
176+
"affinity": "INTEGER",
177+
"notNull": true
178+
},
179+
{
180+
"fieldPath": "associatedAddress",
181+
"columnName": "associated_address",
182+
"affinity": "TEXT",
183+
"notNull": true
184+
},
185+
{
186+
"fieldPath": "firstDetectTimeMs",
187+
"columnName": "first_detect_time_ms",
188+
"affinity": "INTEGER",
189+
"notNull": true
190+
},
191+
{
192+
"fieldPath": "lastDetectTimeMs",
193+
"columnName": "last_detect_time_ms",
194+
"affinity": "INTEGER",
195+
"notNull": true
196+
}
197+
],
198+
"primaryKey": {
199+
"autoGenerate": false,
200+
"columnNames": [
201+
"sha_256"
202+
]
203+
},
204+
"indices": [],
205+
"foreignKeys": []
206+
},
207+
{
208+
"tableName": "location",
209+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`time` INTEGER NOT NULL, `lat` REAL NOT NULL, `lng` REAL NOT NULL, PRIMARY KEY(`time`))",
210+
"fields": [
211+
{
212+
"fieldPath": "time",
213+
"columnName": "time",
214+
"affinity": "INTEGER",
215+
"notNull": true
216+
},
217+
{
218+
"fieldPath": "lat",
219+
"columnName": "lat",
220+
"affinity": "REAL",
221+
"notNull": true
222+
},
223+
{
224+
"fieldPath": "lng",
225+
"columnName": "lng",
226+
"affinity": "REAL",
227+
"notNull": true
228+
}
229+
],
230+
"primaryKey": {
231+
"autoGenerate": false,
232+
"columnNames": [
233+
"time"
234+
]
235+
},
236+
"indices": [
237+
{
238+
"name": "index_location_time",
239+
"unique": false,
240+
"columnNames": [
241+
"time"
242+
],
243+
"orders": [],
244+
"createSql": "CREATE INDEX IF NOT EXISTS `index_location_time` ON `${TABLE_NAME}` (`time`)"
245+
}
246+
],
247+
"foreignKeys": []
248+
},
249+
{
250+
"tableName": "device_to_location",
251+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `device_address` TEXT NOT NULL, `location_time` INTEGER NOT NULL)",
252+
"fields": [
253+
{
254+
"fieldPath": "id",
255+
"columnName": "id",
256+
"affinity": "INTEGER",
257+
"notNull": false
258+
},
259+
{
260+
"fieldPath": "deviceAddress",
261+
"columnName": "device_address",
262+
"affinity": "TEXT",
263+
"notNull": true
264+
},
265+
{
266+
"fieldPath": "locationTime",
267+
"columnName": "location_time",
268+
"affinity": "INTEGER",
269+
"notNull": true
270+
}
271+
],
272+
"primaryKey": {
273+
"autoGenerate": true,
274+
"columnNames": [
275+
"id"
276+
]
277+
},
278+
"indices": [
279+
{
280+
"name": "index_device_to_location_device_address_location_time",
281+
"unique": false,
282+
"columnNames": [
283+
"device_address",
284+
"location_time"
285+
],
286+
"orders": [],
287+
"createSql": "CREATE INDEX IF NOT EXISTS `index_device_to_location_device_address_location_time` ON `${TABLE_NAME}` (`device_address`, `location_time`)"
288+
}
289+
],
290+
"foreignKeys": []
291+
},
292+
{
293+
"tableName": "journal",
294+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `timestamp` INTEGER NOT NULL, `reportJson` TEXT NOT NULL)",
295+
"fields": [
296+
{
297+
"fieldPath": "id",
298+
"columnName": "id",
299+
"affinity": "INTEGER",
300+
"notNull": false
301+
},
302+
{
303+
"fieldPath": "timestamp",
304+
"columnName": "timestamp",
305+
"affinity": "INTEGER",
306+
"notNull": true
307+
},
308+
{
309+
"fieldPath": "report",
310+
"columnName": "reportJson",
311+
"affinity": "TEXT",
312+
"notNull": true
313+
}
314+
],
315+
"primaryKey": {
316+
"autoGenerate": true,
317+
"columnNames": [
318+
"id"
319+
]
320+
},
321+
"indices": [],
322+
"foreignKeys": []
323+
},
324+
{
325+
"tableName": "tag",
326+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, PRIMARY KEY(`name`))",
327+
"fields": [
328+
{
329+
"fieldPath": "name",
330+
"columnName": "name",
331+
"affinity": "TEXT",
332+
"notNull": true
333+
}
334+
],
335+
"primaryKey": {
336+
"autoGenerate": false,
337+
"columnNames": [
338+
"name"
339+
]
340+
},
341+
"indices": [],
342+
"foreignKeys": []
343+
}
344+
],
345+
"views": [],
346+
"setupQueries": [
347+
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
348+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f67e089b6e3087d11b72594e0d5290ea')"
349+
]
350+
}
351+
}

0 commit comments

Comments
 (0)