Search in sources :

Example 1 with DataMessage

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

the class AppLayerProcessor method onOutboundMessage.

@Override
public void onOutboundMessage(Object message, Pipeline pipeline) throws Exception {
    if (!(message instanceof AppLayerMessage))
        return;
    Log.d("SightService", "SEND: " + message.getClass());
    DataMessage dataMessage = new DataMessage();
    dataMessage.setData(((AppLayerMessage) message).serialize());
    pipeline.send(dataMessage);
    Answers.getInstance().logCustom(new CustomEvent("Sent Application Layer Message").putCustomAttribute("Message", message.getClass().getSimpleName()));
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) AppLayerMessage(sugar.free.sightparser.applayer.messages.AppLayerMessage) DataMessage(sugar.free.sightparser.authlayer.DataMessage)

Example 2 with DataMessage

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

the class AppLayerProcessor method onInboundMessage.

@Override
public void onInboundMessage(Object message, Pipeline pipeline) throws Exception {
    if (!(message instanceof DataMessage))
        return;
    DataMessage dataMessage = (DataMessage) message;
    ByteBuf byteBuf = new ByteBuf(dataMessage.getData().length);
    byteBuf.putBytes(dataMessage.getData());
    AppLayerMessage appLayerMessage = AppLayerMessage.deserialize(byteBuf);
    Log.d("SightService", "RECEIVE: " + appLayerMessage.getClass());
    pipeline.receive(appLayerMessage);
    Answers.getInstance().logCustom(new CustomEvent("Received Application Layer Message").putCustomAttribute("Message", appLayerMessage.getClass().getSimpleName()));
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) AppLayerMessage(sugar.free.sightparser.applayer.messages.AppLayerMessage) DataMessage(sugar.free.sightparser.authlayer.DataMessage) ByteBuf(sugar.free.sightparser.pipeline.ByteBuf)

Aggregations

CustomEvent (com.crashlytics.android.answers.CustomEvent)2 AppLayerMessage (sugar.free.sightparser.applayer.messages.AppLayerMessage)2 DataMessage (sugar.free.sightparser.authlayer.DataMessage)2 ByteBuf (sugar.free.sightparser.pipeline.ByteBuf)1