Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
controller: DCS task: Node & DB
Browse files Browse the repository at this point in the history
Add database support for the DCS task (set/get id).
Add Node entry for the DCS task ID.

Signed-off-by: itay elenzweig <[email protected]>
  • Loading branch information
itayx authored and Alex Kanter committed Jan 20, 2020
1 parent 734a2c5 commit 5cc493c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions controller/src/beerocks/master/db/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3320,6 +3320,29 @@ bool db::assign_rdkb_wlan_task_id(int new_task_id)

int db::get_rdkb_wlan_task_id() { return rdkb_wlan_task_id; }

bool db::assign_dynamic_channel_selection_task_id(const sMacAddr &mac, int new_task_id)
{
auto n = get_node(mac);
if (!n) {
LOG(WARNING) << __FUNCTION__ << " - node " << network_utils::mac_to_string(mac)
<< " does not exist!";
return false;
}
n->dynamic_channel_selection_task_id = new_task_id;
return true;
}

int db::get_dynamic_channel_selection_task_id(const sMacAddr &mac)
{
auto n = get_node(mac);
if (!n) {
LOG(WARNING) << __FUNCTION__ << " - node " << network_utils::mac_to_string(mac)
<< " does not exist!";
return -1;
}
return n->dynamic_channel_selection_task_id;
}

void db::lock() { db_mutex.lock(); }

void db::unlock() { db_mutex.unlock(); }
Expand Down
3 changes: 3 additions & 0 deletions controller/src/beerocks/master/db/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,9 @@ class db {
bool assign_channel_selection_task_id(int new_task_id);
int get_channel_selection_task_id();

bool assign_dynamic_channel_selection_task_id(const sMacAddr &mac, int new_task_id);
int get_dynamic_channel_selection_task_id(const sMacAddr &mac);

void lock();
void unlock();

Expand Down
1 change: 1 addition & 0 deletions controller/src/beerocks/master/db/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class node {
int load_balancer_task_id = -1;
int client_locating_task_id_new_connection = -1;
int client_locating_task_id_exist_connection = -1;
int dynamic_channel_selection_task_id = -1;

std::chrono::steady_clock::time_point measurement_sent_timestamp;
int measurement_recv_delta = 0;
Expand Down

0 comments on commit 5cc493c

Please sign in to comment.