Merge pull request #38 from berlin-open-wireless-lab/feature/use_notify

Feature/use notify
This commit is contained in:
Polynomdivision 2018-01-04 12:13:15 +01:00 committed by GitHub
commit 0cde3df6de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -35,4 +35,4 @@ config metric
option min_probe_count '4'
option bandwith_threshold '6'
option use_station_count '1'
option eval_probe_req '1'
option eval_probe_req '1'

View file

@ -188,8 +188,11 @@ int hostapd_array_check_id(uint32_t id);
void hostapd_array_insert(uint32_t id);
void hostapd_array_delete(uint32_t id);
static void ubus_add_oject();
static void respond_to_notify(uint32_t id);
void add_client_update_timer(time_t time) {
uloop_timeout_set(&client_timer, time);
}
@ -591,6 +594,9 @@ static int add_subscriber(char *name) {
hostapd_array_insert(id);
fprintf(stderr, "Watching object %08x: %s\n", id, ubus_strerror(ret));
// respond to notify...
respond_to_notify(id);
return 0;
}
@ -1007,4 +1013,14 @@ static void ubus_add_oject()
if (ret)
fprintf(stderr, "Failed to add watch handler: %s\n", ubus_strerror(ret));
*/
}
static void respond_to_notify(uint32_t id) {
printf("SENDING NOTIFY!!!\n");
blob_buf_init(&b, 0);
blobmsg_add_u32(&b, "notify_response", 1);
int timeout = 1;
ubus_invoke(ctx, id, "notify_response", b.head, NULL, NULL, timeout * 1000);
}