com.btchip.utils.Dump Java Examples

The following examples show how to use com.btchip.utils.Dump. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BitcoinTransaction.java    From green_android with GNU General Public License v3.0 6 votes vote down vote up
public String toString() {
	StringBuffer buffer = new StringBuffer();
	buffer.append("Version ").append(Dump.dump(version)).append('\r').append('\n');
	int index = 1;
	for (BitcoinInput input : inputs) {
		buffer.append("Input #").append(index).append('\r').append('\n');
		buffer.append(input.toString());
		index++;
	}
	index = 1;
	for (BitcoinOutput output : outputs) {
		buffer.append("Output #").append(index).append('\r').append('\n');
		buffer.append(output.toString());
		index++;			
	}
	buffer.append("LockTime ").append(Dump.dump(lockTime)).append('\r').append('\n');
	return buffer.toString();
}
 
Example #2
Source File: BitcoinTransaction.java    From GreenBits with GNU General Public License v3.0 6 votes vote down vote up
public String toString() {
	StringBuffer buffer = new StringBuffer();
	buffer.append("Version ").append(Dump.dump(version)).append('\r').append('\n');
	int index = 1;
	for (BitcoinInput input : inputs) {
		buffer.append("Input #").append(index).append('\r').append('\n');
		buffer.append(input.toString());
		index++;
	}
	index = 1;
	for (BitcoinOutput output : outputs) {
		buffer.append("Output #").append(index).append('\r').append('\n');
		buffer.append(output.toString());
		index++;			
	}
	buffer.append("LockTime ").append(Dump.dump(lockTime)).append('\r').append('\n');
	return buffer.toString();
}
 
Example #3
Source File: BitcoinTransaction.java    From WalletCordova with GNU Lesser General Public License v2.1 6 votes vote down vote up
public String toString() {
	StringBuffer buffer = new StringBuffer();
	buffer.append("Version ").append(Dump.dump(version)).append('\r').append('\n');
	int index = 1;
	for (BitcoinInput input : inputs) {
		buffer.append("Input #").append(index).append('\r').append('\n');
		buffer.append(input.toString());
		index++;
	}
	index = 1;
	for (BitcoinOutput output : outputs) {
		buffer.append("Output #").append(index).append('\r').append('\n');
		buffer.append(output.toString());
		index++;			
	}
	buffer.append("LockTime ").append(Dump.dump(lockTime)).append('\r').append('\n');
	return buffer.toString();
}
 
Example #4
Source File: BTChipTransportAndroidNFC.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public Future<byte[]> exchangeInternal(byte[] command) throws BTChipException {		
	try {
		if (!card.isConnected()) {
			card.connect();
			card.setTimeout(timeout);
			if (debug) {
				Log.d(BTChipTransportAndroid.LOG_STRING, "Connected");
			}
		}
		if (debug) {
			Log.d(BTChipTransportAndroid.LOG_STRING, "=> " + Dump.dump(command));
		}
		byte[] commandLe = new byte[command.length + 1];
		System.arraycopy(command, 0, commandLe, 0, command.length);
		byte[] response = card.transceive(commandLe);
		if (debug) {
			Log.d(BTChipTransportAndroid.LOG_STRING, "<= " + Dump.dump(response));
		}
		return FutureUtils.getDummyFuture(response);			
	}
	catch(Exception e) {
		try {
			card.close();
		}
		catch(Exception e1) {				
		}
		throw new BTChipException("I/O error", e);
	}
	
}
 
Example #5
Source File: BTChipTransportAndroidNFC.java    From WalletCordova with GNU Lesser General Public License v2.1 5 votes vote down vote up
public byte[] exchangeInternal(byte[] command) throws BTChipException {		
	try {
		if (!card.isConnected()) {
			card.connect();
			card.setTimeout(timeout);
			if (debug) {
				Log.d(BTChipTransportAndroid.LOG_STRING, "Connected");
			}
		}
		if (debug) {
			Log.d(BTChipTransportAndroid.LOG_STRING, "=> " + Dump.dump(command));
		}
		byte[] commandLe = new byte[command.length + 1];
		System.arraycopy(command, 0, commandLe, 0, command.length);
		byte[] response = card.transceive(commandLe);
		if (debug) {
			Log.d(BTChipTransportAndroid.LOG_STRING, "<= " + Dump.dump(response));
		}
		return response;			
	}
	catch(Exception e) {
		try {
			card.close();
		}
		catch(Exception e1) {				
		}
		throw new BTChipException("I/O error", e);
	}
	
}
 
Example #6
Source File: BTChipTransportAndroidHID.java    From xmrwallet with Apache License 2.0 5 votes vote down vote up
@Override
public byte[] exchange(byte[] command) {
    ByteArrayOutputStream response = new ByteArrayOutputStream();
    byte[] responseData = null;
    int offset = 0;
    if (debug) {
        Timber.d("=> %s", Dump.dump(command));
    }
    command = LedgerHelper.wrapCommandAPDU(LEDGER_DEFAULT_CHANNEL, command, HID_BUFFER_SIZE);
    UsbRequest requestOut = new UsbRequest();
    requestOut.initialize(connection, out);
    while (offset != command.length) {
        int blockSize = (command.length - offset > HID_BUFFER_SIZE ? HID_BUFFER_SIZE : command.length - offset);
        System.arraycopy(command, offset, transferBuffer, 0, blockSize);
        requestOut.queue(ByteBuffer.wrap(transferBuffer), HID_BUFFER_SIZE);
        connection.requestWait();
        offset += blockSize;
    }
    requestOut.close();
    ByteBuffer responseBuffer = ByteBuffer.allocate(HID_BUFFER_SIZE);
    UsbRequest requestIn = new UsbRequest();
    requestIn.initialize(connection, in);
    while ((responseData = LedgerHelper.unwrapResponseAPDU(LEDGER_DEFAULT_CHANNEL, response.toByteArray(), HID_BUFFER_SIZE)) == null) {
        responseBuffer.clear();
        requestIn.queue(responseBuffer, HID_BUFFER_SIZE);
        connection.requestWait();
        responseBuffer.rewind();
        responseBuffer.get(transferBuffer, 0, HID_BUFFER_SIZE);
        response.write(transferBuffer, 0, HID_BUFFER_SIZE);
    }
    requestIn.close();
    if (debug) {
        Timber.d("<= %s", Dump.dump(responseData));
    }
    return responseData;
}
 
Example #7
Source File: LedgerTransportTEEProxy.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Future<byte[]> exchange(byte[] command) throws BTChipException {
	ServiceResult result;
			
	if (debug) {
		Log.d(BTChipTransportAndroid.LOG_STRING, "=> " + Dump.dump(command));
	}
	if (service == null) {
		throw new BTChipException("Service is not available");
	}		
	if (session == null) {
		throw new BTChipException("Session is not open");
	}
	try {
		if (needExternalUI(command)) {
			result = service.exchangeExtendedUI(session, command);						
		}
		else {
			result = service.exchange(session, command);
		}
	}
	catch(Exception e) {
		throw new BTChipException("Exception calling service", e);
	}
	if (result.getExceptionMessage() != null) {
		Log.d(TAG, "Exchange failed " + result.getExceptionMessage());
		return null;
	}
	Log.d(BTChipTransportAndroid.LOG_STRING, "<= " + Dump.dump(result.getResult()));		
	return FutureUtils.getDummyFuture(result.getResult());
}
 
Example #8
Source File: BTChipDongle.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Value %s confirmation type %s", Dump.dump(value), userConfirmation);
}
 
Example #9
Source File: BTChipDongle.java    From WalletCordova with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public String toString() {
	return String.format("%s screen data %s", super.toString(), Dump.dump(screenInfo));
}
 
Example #10
Source File: BTChipDongle.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("%s screen data %s", super.toString(), Dump.dump(screenInfo));
}
 
Example #11
Source File: BitcoinTransaction.java    From WalletCordova with GNU Lesser General Public License v2.1 4 votes vote down vote up
public String toString() {
	return String.format("Prevout %s\r\nScript %s\r\nSequence %s\r\n", Dump.dump(prevOut),
			Dump.dump(script), Dump.dump(sequence));
}
 
Example #12
Source File: BitcoinTransaction.java    From WalletCordova with GNU Lesser General Public License v2.1 4 votes vote down vote up
public String toString() {
	return String.format("Amount %s\r\nScript %s\r\n", Dump.dump(amount), Dump.dump(script));
}
 
Example #13
Source File: BTChipDongle.java    From WalletCordova with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Address %s public key %s chaincode %s", address, Dump.dump(publicKey), Dump.dump(chainCode));
}
 
Example #14
Source File: BTChipDongle.java    From WalletCordova with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Signature %s y parity %s", Dump.dump(signature), yParity);
}
 
Example #15
Source File: BTChipDongle.java    From WalletCordova with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Value %s trusted %b", Dump.dump(value), trusted);
}
 
Example #16
Source File: BTChipDongle.java    From WalletCordova with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Value %s confirmation type %s", Dump.dump(value), userConfirmation);
}
 
Example #17
Source File: BitcoinTransaction.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
public String toString() {
	return String.format("Prevout %s\r\nScript %s\r\nSequence %s\r\n", Dump.dump(prevOut),
			Dump.dump(script), Dump.dump(sequence));
}
 
Example #18
Source File: BTChipDongle.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Value %s trusted %b sequence %s segwit %b", Dump.dump(value), trusted, (sequence != null ? Dump.dump(sequence) : ""), segwit);
}
 
Example #19
Source File: BTChipDongle.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Signature %s y parity %s", Dump.dump(signature), yParity);
}
 
Example #20
Source File: BTChipDongle.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Address %s public key %s chaincode %s", address, Dump.dump(publicKey), Dump.dump(chainCode));
}
 
Example #21
Source File: BitcoinTransaction.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
public String toString() {
	return String.format("Amount %s\r\nScript %s\r\n", Dump.dump(amount), Dump.dump(script));
}
 
Example #22
Source File: BitcoinTransaction.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
public String toString() {
	return String.format("Prevout %s\r\nScript %s\r\nSequence %s\r\n", Dump.dump(prevOut),
			Dump.dump(script), Dump.dump(sequence));
}
 
Example #23
Source File: BTChipDongle.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("%s screen data %s", super.toString(), Dump.dump(screenInfo));
}
 
Example #24
Source File: BTChipDongle.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Value %s confirmation type %s", Dump.dump(value), userConfirmation);
}
 
Example #25
Source File: BTChipDongle.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Liquid Value %s sequence %s", Dump.dump(value), (sequence != null ? Dump.dump(sequence) : ""));
}
 
Example #26
Source File: BTChipDongle.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Value %s trusted %b sequence %s segwit %b", Dump.dump(value), trusted, (sequence != null ? Dump.dump(sequence) : ""), segwit);
}
 
Example #27
Source File: BTChipDongle.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Signature %s y parity %s", Dump.dump(signature), yParity);
}
 
Example #28
Source File: BTChipDongle.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public String toString() {
	return String.format("Address %s public key %s chaincode %s", address, Dump.dump(publicKey), Dump.dump(chainCode));
}
 
Example #29
Source File: BitcoinTransaction.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
public String toString() {
	return String.format("Amount %s\r\nScript %s\r\n", Dump.dump(amount), Dump.dump(script));
}