Package ch.ethz.inf.vs.californium.observe

Examples of ch.ethz.inf.vs.californium.observe.ObserveRelation.cancel()


      if (exchange.getRequest().isAcknowledged() || exchange.getRequest().getType()==Type.NON) {
        // Transmit errors as CON
        if (!ResponseCode.isSuccess(response.getCode())) {
          LOGGER.fine("Response has error code "+response.getCode()+" and must be sent as CON");
          response.setType(Type.CON);
          relation.cancel();
        } else {
          // Make sure that every now and than a CON is mixed within
          if (relation.check()) {
            LOGGER.fine("The observe relation requires the notification to be sent as CON");
            response.setType(Type.CON);
View Full Code Here


    // sendResponse into the method rejected().
    if (message.getType() == Type.RST && exchange.getOrigin() == Origin.REMOTE) {
      // The response has been rejected
      ObserveRelation relation = exchange.getRelation();
      if (relation != null) {
        relation.cancel();
      } // else there was no observe relation ship and this layer ignores the rst
    }
    super.receiveEmptyMessage(exchange, message);
  }
 
View Full Code Here

        exchange.setRelation(relation);
        // all that's left is to add the relation to the resource which
        // the resource must do itself if the response is successful
      } else if (request.getOptions().getObserve()==1) {
        ObserveRelation relation = observeManager.getRelation(source, request.getToken());
        if (relation!=null) relation.cancel();
      }
    }
  }

  /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.