Code example for UsbDeviceConnection

Methods: bulkTransfer, sleep

0
	private static void sendAck() { 
		_port_write(ACK, ACK.length);
 
		// wait 1ms 
		try { 
			Thread.sleep(1000);
		} 
		catch(Exception ex) {
		} 
	} 
 
	/** 
	 * DCS計算 
	 * 
	 * @param[in]		data		計算元データ 
	 * @param[in]		len			dataの長さ 
	 * 
	 * @return			DCS値 
	 */ 
	private static byte _calc_dcs(final byte[] data, int len, int offset)
	{ 
		byte sum = 0;
		for(short i = 0; i < len; i++) {
			sum += data[offset + i];
		} 
		return (byte)(0 - (sum & 0xff));
	} 
 
	private static byte _calc_dcs(final byte[] data, int len) {
		return _calc_dcs(data, len, 0);
	} 
 
	//////////////////////////////////////////////////// 
	private static synchronized short _port_write(final byte[] data, int len) {
		int ret = mDeviceConnection.bulkTransfer(mEndpointOut, data, len, 500);
		return (short)ret;
	} 
 
	private static synchronized short _port_read(byte[] data, int len) {
		int ret;