LrJposChannel.resetCounters

Resets the counters for connected clients, sent messages, and received messages.

public static void resetCounters()

Return values

This function does not return any values.

General information

The internal counter stores the data in an array of integers:

  • A[0]: Number of connections.

  • A[1]: Number of sent messages.

  • A[2]: Number of received messages.

This function can reset all counters to zero.

Received messages using the getBytes function are not counted within this array.

Example

Copy code
public void checkAndResetCurrentCounters() {      

        int counters[] = LrJposChannel.getCounters();
        if (counters.length<3) {
            lr.error_message("we should have 3 entries in counters array");
            return;
        }
        lr.output_message("Connections#" + counters[0]);
        lr.output_message("SentMessges#" + counters[1]);
        lr.output_message("ReceivedMessages#" + counters[2]);
        
        lr.output_message("resetting counters");
        LrJposChannel.resetCounters();
        
        counters = LrJposChannel.getCounters();
        if (counters.length<3) {
            lr.error_message("we should have 3 entries in counters array");
            return;
        }
        lr.output_message("Connections#" + counters[0]);
        lr.output_message("SentMessges#" + counters[1]);
        lr.output_message("ReceivedMessages#" + counters[2]);
 }