@@ -0,0 +1,2312 @@
+package com.uxxu.konashi.lib;%0A%0Aimport android.bluetooth.BluetoothGatt;%0Aimport android.bluetooth.BluetoothGattCharacteristic;%0Aimport android.bluetooth.BluetoothGattService;%0A%0Aimport java.util.UUID;%0A%0Aimport info.izumin.android.bletia.Bletia;%0Aimport info.izumin.android.bletia.BletiaException;%0Aimport info.izumin.android.bletia.BletiaListener;%0A%0A/**%0A * Created by izumin on 9/23/15.%0A */%0Aclass CallbackHandler implements BletiaListener %7B%0A%0A    private final EventEmitter mEmitter;%0A    private final KonashiManager mManager;%0A%0A    public CallbackHandler(KonashiManager manager, EventEmitter emitter) %7B%0A        mManager = manager;%0A        mEmitter = emitter;%0A    %7D%0A%0A    @Override%0A    public void onConnect(Bletia bletia) %7B%0A        mEmitter.emitConnect(mManager);%0A        bletia.discoverServices();%0A    %7D%0A%0A    @Override%0A    public void onDisconnect(Bletia bletia) %7B%0A        mEmitter.emitDisconnect(mManager);%0A    %7D%0A%0A    @Override%0A    public void onError(BletiaException e) %7B%0A        KonashiUtils.log(e.getType().getName());%0A        mEmitter.emitError(mManager, e);%0A    %7D%0A%0A    @Override%0A    public void onServicesDiscovered(Bletia bletia, int status) %7B%0A        if (status == BluetoothGatt.GATT_SUCCESS) %7B%0A            BluetoothGattService service = bletia.getService(KonashiUUID.KONASHI_SERVICE_UUID);%0A            bletia.enableNotification(service.getCharacteristic(KonashiUUID.PIO_INPUT_NOTIFICATION_UUID), true);%0A            bletia.enableNotification(service.getCharacteristic(KonashiUUID.UART_RX_NOTIFICATION_UUID), true);%0A            bletia.enableNotification(service.getCharacteristic(KonashiUUID.HARDWARE_LOW_BAT_NOTIFICATION_UUID), true);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void onCharacteristicChanged(Bletia bletia, BluetoothGattCharacteristic characteristic) %7B%0A        UUID uuid = characteristic.getUuid();%0A%0A        if (KonashiUUID.PIO_INPUT_NOTIFICATION_UUID.equals(uuid)) %7B%0A            mEmitter.emitUpdatePioOutput(mManager, characteristic.getValue()%5B0%5D);%0A        %7D else if (KonashiUUID.UART_RX_NOTIFICATION_UUID.equals(uuid)) %7B%0A            mEmitter.emitUpdateUartRx(mManager, characteristic.getValue());%0A        %7D else if (KonashiUUID.HARDWARE_LOW_BAT_NOTIFICATION_UUID.equals(uuid)) %7B%0A            mEmitter.emitUpdateBatteryLevel(mManager, KonashiUtils.getBatteryLevel(characteristic));%0A        %7D%0A    %7D%0A%7D%0A

Add CallbackHandler