package meerkat.pollingstation;

import com.google.protobuf.ByteString;
import meerkat.protobuf.PollingStation;

import java.nio.ByteBuffer;

import static meerkat.pollingstation.PollingStationConstants.POLLING_STATION_WEB_SCANNER_SCAN_PATH;

/**
 * Created by Laura on 3/20/2017.
 */
public class PollingStationClientToyRun {
    public static void main(String [] args) {
        int channel = 10;
        System.out.println("Message to send: "+channel);
        byte[] data = ByteBuffer.allocate(4).putInt(channel).array();
//        byte[] data = {(byte) 1, (byte) 2};

        PollingStation.ScannedBallot scannedBallot = PollingStation.ScannedBallot.newBuilder()
                .setChannel(ByteString.copyFrom(data))
                .build();

//        int retrieved = ByteBuffer.wrap(scannedData.getChannel().toByteArray()).getInt();
//        System.out.println(retrieved);
//        System.out.println("Channel int initial:"+channel);
//        System.out.println("Channel int retrieved:"+retrieved);

        PollingStationScanner.ScannerClient scannerClient = new ScannerClientAPI();

//        boolean sent = scannerClient.sendScan(scannedData);
//
//        System.out.println("Message sent successfully: "+sent);
    }
}
