void Casan::send_discover (Msg &out) { char tmpstr [CASAN_BUF_LEN] ; l2addr *dest ; DBGLN1 (F ("Sending Discover")) ; out.reset () ; out.set_id (curid_++) ; out.set_type (COAP_TYPE_NON) ; out.set_code (COAP_CODE_POST) ; mk_ctl_msg (out) ; snprintf (tmpstr, sizeof tmpstr, CASAN_DISCOVER_SLAVEID, slaveid_) ; option o1 (option::MO_Uri_Query, tmpstr, strlen (tmpstr)) ; out.push_option (o1) ; snprintf (tmpstr, sizeof tmpstr, CASAN_DISCOVER_MTU, (long int) defmtu_) ; option o2 (option::MO_Uri_Query, tmpstr, strlen (tmpstr)) ; out.push_option (o2) ; dest = (master_ != NULL) ? master_ : l2_->bcastaddr () ; out.send (*dest) ; }
void Casan::check_observed_resources (Msg &out) { Resource *res ; reslist *rl ; for (rl = reslist_ ; rl != NULL ; rl = rl->next) { res = rl->res ; if (res->check_trigger ()) { DBG1 (F (B_BLUE "Observed resource '")) ; DBG1 (rl->res->name ()) ; DBG1 (F ("' triggered" C_RESET)) ; DBGLN0 () ; out.reset () ; out.set_type (COAP_TYPE_ACK) ; out.set_token (res->get_token ()) ; out.set_id (curid_++) ; out.set_code (COAP_CODE_OK) ; option obs (option::MO_Observe, res->next_serial ()) ; out.push_option (obs) ; request_resource (NULL, &out, res) ; out.send (*master_) ; } } }