Commit b12eb5ee authored by Adam Barta's avatar Adam Barta
Browse files

sensors for roach pool

parent eafdad11
Showing with 16 additions and 1 deletion
+16 -1
......@@ -146,6 +146,8 @@ int add_roach_to_pool_kcs(struct katcp_dispatch *d, char *pool, char *url, char
struct kcs_obj *roachpool_get_obj_by_name_kcs(struct katcp_dispatch *d, char *name);
int mod_roach_to_new_pool(struct kcs_obj *root, char *pool, char *hostname);
int roachpool_count_kcs(struct katcp_dispatch *d);
int update_sensor_for_roach_kcs(struct katcp_dispatch *d, struct kcs_obj *ko, int val);
int add_sensor_to_roach_kcs(struct katcp_dispatch *d, struct kcs_obj *ko);
#define KCS_SM_PING_STOP 0
#define KCS_SM_PING_S1 1
......
......@@ -210,6 +210,7 @@ int add_new_roach_to_tree(struct kcs_obj *root, char *poolname, char *url, char
int update_sensor_for_roach_kcs( struct katcp_dispatch *d, struct kcs_obj *ko, int val)
{
struct kcs_roach *kr;
struct katcp_acquire *a;
if (ko == NULL)
return KATCP_RESULT_FAIL;
......@@ -222,7 +223,10 @@ int update_sensor_for_roach_kcs( struct katcp_dispatch *d, struct kcs_obj *ko, i
if (kr == NULL)
return KATCP_RESULT_FAIL;
a = kr->r_acquire;
if (set_boolean_acquire_katcp(d, a, val) < 0)
return KATCP_RESULT_FAIL;
return KATCP_RESULT_OK;
}
......
......@@ -267,6 +267,12 @@ int connect_sm_kcs(struct katcp_dispatch *d, struct katcp_notice *n, void *data)
}
log_message_katcp(d,KATCP_LEVEL_INFO, NULL, "Success: roach %s moved to pool %s", kr->kurl->u_str, newpool);
if (add_sensor_to_roach_kcs(d, ko) < 0){
}
update_sensor_for_roach_kcs(d, ko, 1);
p = create_parse_katcl();
if (p == NULL){
......@@ -321,6 +327,9 @@ int disconnect_sm_kcs(struct katcp_dispatch *d, struct katcp_notice *n, void *da
else {
log_message_katcp(d,KATCP_LEVEL_INFO, NULL, "Success: roach %s moved to pool %s", kr->kurl->u_str, newpool);
}
update_sensor_for_roach_kcs(d, ko, 0);
/*if (kr->io_ksm){
destroy_ksm_kcs(kr->io_ksm);
kr->io_ksm = NULL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment