Search in sources :

Example 1 with CRCAuthLayerMessage

use of sugar.free.sightparser.authlayer.CRCAuthLayerMessage in project SightRemote by TebbeUbben.

the class AuthLayerProcessor method onOutboundMessage.

@Override
public void onOutboundMessage(Object message, Pipeline pipeline) throws Exception {
    if (!(message instanceof AuthLayerMessage))
        return;
    AuthLayerMessage data = (AuthLayerMessage) message;
    BigInteger nonce = pipeline.getLastNonceSent();
    if (!(data instanceof CRCAuthLayerMessage))
        nonce = nonce.add(BigInteger.ONE);
    pipeline.send(data.serialize(nonce, (message instanceof KeyRequest) ? 1 : pipeline.getCommID(), pipeline.getDerivedKeys() != null ? pipeline.getDerivedKeys().getOutgoingKey() : null));
    pipeline.setLastNonceSent(nonce);
}
Also used : AuthLayerMessage(sugar.free.sightparser.authlayer.AuthLayerMessage) CRCAuthLayerMessage(sugar.free.sightparser.authlayer.CRCAuthLayerMessage) CRCAuthLayerMessage(sugar.free.sightparser.authlayer.CRCAuthLayerMessage) BigInteger(java.math.BigInteger) KeyRequest(sugar.free.sightparser.authlayer.KeyRequest)

Aggregations

BigInteger (java.math.BigInteger)1 AuthLayerMessage (sugar.free.sightparser.authlayer.AuthLayerMessage)1 CRCAuthLayerMessage (sugar.free.sightparser.authlayer.CRCAuthLayerMessage)1 KeyRequest (sugar.free.sightparser.authlayer.KeyRequest)1