private void close() throws BITalinoException {
        try {
            socket.close();
        } catch (Exception e) {
            throw new BITalinoException(BITalinoErrorTypes.BT_DEVICE_NOT_CONNECTED);
        } finally {
            socket = null;
        }
    }