Package 

Class JsonMerger

  • All Implemented Interfaces:
    no.nordicsemi.android.ble.data.DataMerger

    
    public class JsonMerger
     implements DataMerger
                        

    A data merger object that returns true when complete JSON has been received.

    It will consume packets until the JSON object can be created.

    • Method Summary

      Modifier and Type Method Description
      boolean merge(@NonNull() DataStream output, @Nullable() Array<byte> lastPacket, int index) This method should merge the last packet into the output message.
      void reset() Resets the merger so it can start merging from scratch.
      • Methods inherited from class no.nordicsemi.android.ble.data.DataMerger

        merge
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • merge

         boolean merge(@NonNull() DataStream output, @Nullable() Array<byte> lastPacket, int index)

        This method should merge the last packet into the output message.

        Parameters:
        output - the stream for the output message, initially empty.
        lastPacket - the data received in the last read/notify/indicate operation.
        index - an index of the packet, 0-based (if you expect 3 packets, they will becalled with indexes 0, 1, 2).
      • reset

         void reset()

        Resets the merger so it can start merging from scratch.