package com.friendlyarm.AndroidSDK;
import android.util.Log;
/**
* 鎻忚堪锛氬嚱鏁板簱鎺ュ彛
* @author Administrator
*
*/
public class HardwareControler
{
/**
* 鎻忚堪锛氭墦寮€鎸囧畾鐨勪覆鍙h澶囷紝骞惰繑鍥炴枃浠舵弿杩扮
* @param devName 涓插彛璁惧鏂囦欢鍚?
* @param baud 娉㈢壒鐜?
* @param dataBits 鏁版嵁浣?
* @param stopBits 鍋滄浣?
* @return 鏂囦欢鎻忚堪绗?
*/
static public native int openSerialPort( String devName, long baud, int dataBits, int stopBits );
/**
* 鎻忚堪锛氬紑鍏矻ED鐏?
* @param ledID 鎸囧畾寮€鍏冲摢涓€涓狶ED鐏紙1-3锛?
* @param ledState 1琛ㄧず浜紝0琛ㄧず鐏?
* @return 鎴愬姛杩斿洖0 澶辫触杩斿洖-1
*/
static public native int setLedState( int ledID, int ledState );
/**
* 鎻忚堪锛氭寜鎸囧畾棰戠巼璁╄渹楦e櫒鍙戝0
* @param frequency 瑕佸彂澹扮殑棰戠巼
* @return 鎴愬姛杩斿洖0 澶辫触杩斿洖-1
*/
static public native int PWMPlay(int frequency);
/**
* 鎻忚堪锛氳铚傞福鍣ㄥ仠姝㈠彂澹?
* @return 鎴愬姛杩斿洖0 澶辫触杩斿洖-1
*/
static public native int PWMStop();
/**
* 鎻忚堪锛氳鍙朅DC杞崲缁撴灉
* @return
*/
static public native int readADC();
/**
* 鎻忚堪锛氭墦寮€IIC璁惧
* @return
*/
static public native int openI2CDevice();
/**
* 鎻忚堪锛氳鍙栨暟鎹?
* @param fd
* @param pos
* @param byteData
* @return
*/
static public native int writeByteDataToI2C(int fd, int pos, byte byteData);
/**
* 鎻忚堪锛氬啓鍏ユ暟鎹?
* @param fd
* @param pos
* @return
*/
static public native int readByteDataFromI2C(int fd, int pos);
/**
* 鎻忚堪锛氬悜鎵撳紑鐨勮澶囨垨鏂囦欢涓啓鍏ユ暟鎹?
* @param fd
* @param data
* @return
*/
static public native int write(int fd, byte[] data);
/**
* 鎻忚堪锛氫粠鎵撳紑鐨勮澶囨垨鏂囦欢涓鍙栨暟鎹?
* @param fd
* @param buf
* @param len
* @return
*/
static public native int read(int fd, byte[] buf, int len);
/**
* 鎻忚堪锛氭煡璇㈡墦寮€鐨勮澶囨垨鏂囦欢涓槸鍚︽暟鎹彲璇?
* @param fd
* @param sec
* @param usec
* @return
*/
static public native int select(int fd, int sec, int usec);
/**
* 鎻忚堪锛氬叧闂寚瀹氳澶囨垨鏂囦欢
* @param fd
*/
static public native void close(int fd);
static {
try {
System.loadLibrary("friendlyarm-hardware");
} catch (UnsatisfiedLinkError e) {
Log.d("HardwareControler", "libfriendlyarm-hardware library not found!");
}
}
}
更多源码 | 好库简介 | 网站地图 | 帮助中心 | 版权说明
Copyright© 2009-2012 OKBASE.NET All Rights Reserved 好库网 版权所有
这是一个Java编写的智能家居管理系统,包含硬件控制器类,支持串口、LED状态控制、PWM频率设置、ADC读取、I2C设备操作等功能,适用于手机客户端应用。


被折叠的 条评论
为什么被折叠?



