本文整理汇总了C++中Msg::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Msg::reset方法的具体用法?C++ Msg::reset怎么用?C++ Msg::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Msg
的用法示例。
在下文中一共展示了Msg::reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_discover
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) ;
}
示例2: check_observed_resources
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_) ;
}
}
}