⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parameters.java

📁 JRed is a 100% Java implementation of the IrDA infrared communications protocols. JRed lets you beam
💻 JAVA
字号:
/*
**************************************************************************
** $Header: /cvsroot/jred/jred/src/com/synchrona/jred/irlap/Parameters.java,v 1.1.1.1 2000/07/05 04:41:53 mpatters Exp $
**
** Copyright (C) 2000 Synchrona, Inc. All rights reserved.
**
** This file is part of JRed, a 100% Java implementation of the IrDA
** infrared communications protocols.
**
** This file may be distributed under the terms of the Synchrona Public
** License as defined by Synchrona, Inc. and appearing in the file
** LICENSE included in the packaging of this file. The Synchrona Public
** License is based on the Q Public License as defined by Troll Tech AS
** of Norway; it differs only in its use of the courts of Florida, USA
** rather than those of Oslo, Norway.
**************************************************************************
*/
package com.synchrona.jred.irlap;

public class Parameters {
	public static final int BAUD_RATE           = 0x01;
	public static final int MAX_TURNAROUND_TIME = 0x82;

	protected int _baudRate;
	protected int _maxTurnaroundTime;

	public static Parameters parseBytes(byte [] data) throws Exception {
		int i = 0;
		while ( i < data.length ) {
			int flag   = data[i++];
			int length = data[i++];

			if ( length != 1 ) {
				throw new Exception("Multi-byte IrLAP parameter sequences are not supported yet.");
			}

			switch ( flag ) {
				case BAUD_RATE:
				break;
				case MAX_TURNAROUND_TIME:
				break;
			}
		}
	}

	public int getBaudRate() {
		return _baudRate;
	}

	public void setConnectionParameters(byte [] ayParameters) throws Exception {
		m_log.debug("IrLAPFramer", "[setConnectionParameters] do nothing for now");

		int i = 0;

		m_ayCommParameters[i++] = (byte) 0x01; // (1) baud rate
		m_ayCommParameters[i++] = (byte) 0x01; // data is 1 byte in length
		m_ayCommParameters[i++] = (byte) 0x02; // 9600 bps

		m_ayCommParameters[i++] = (byte) 0x82; // (2) max turnaround time
		m_ayCommParameters[i++] = (byte) 0x01; // data is 1 byte in length
		m_ayCommParameters[i++] = (byte) 0x01; // data is 1 byte in length

		m_ayCommParameters[i++] = (byte) 0x83; // (3) data size
		m_ayCommParameters[i++] = (byte) 0x01; // data is 1 byte in length
		m_ayCommParameters[i++] = (byte) 0x01; // 500ms

		m_ayCommParameters[i++] = (byte) 0x84; // (4) window size
		m_ayCommParameters[i++] = (byte) 0x01; // data is 1 byte in length
		m_ayCommParameters[i++] = (byte) 0x01; // stop-and-wait; 1 frame/window

		m_ayCommParameters[i++] = (byte) 0x85; // (5) additional BOF's
		m_ayCommParameters[i++] = (byte) 0x01; // data is 1 byte in length
		m_ayCommParameters[i++] = (byte) 0x01; // 48 BOF's @ 115200

		m_ayCommParameters[i++] = (byte) 0x86; // (6) min turnaround time
		m_ayCommParameters[i++] = (byte) 0x01; // data is 1 byte in length
		m_ayCommParameters[i++] = (byte) 0x01; // 3 seconds

		m_ayCommParameters[i++] = (byte) 0x08; // (7) link disconnect time
		m_ayCommParameters[i++] = (byte) 0x01; // data is 1 byte in length
		m_ayCommParameters[i++] = (byte) 0x80; // 40 seconds
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -