本文整理汇总了Java中it.gerdavax.easybluetooth.RemoteDevice类的典型用法代码示例。如果您正苦于以下问题:Java RemoteDevice类的具体用法?Java RemoteDevice怎么用?Java RemoteDevice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RemoteDevice类属于it.gerdavax.easybluetooth包,在下文中一共展示了RemoteDevice类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getView
import it.gerdavax.easybluetooth.RemoteDevice; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
LinearLayout view = null;
if (convertView == null) {
view = new LinearLayout(DeviceDiscovery.this);
String inflater = Context.LAYOUT_INFLATER_SERVICE;
LayoutInflater vi = (LayoutInflater) DeviceDiscovery.this.getSystemService(inflater);
vi.inflate(R.layout.discovered_devices_list_item, view, true);
} else {
view = (LinearLayout) convertView;
}
TextView addressTextView = (TextView) view.findViewById(R.id.device_address);
TextView nameTextView = (TextView) view.findViewById(R.id.device_name);
RemoteDevice device = discoveredDevices.get(position);
String address = device.getAddress();
String name = device.getFriendlyName();
addressTextView.setText(address);
nameTextView.setText((name==null) ? "NONAME" : name);
return view;
}
示例2: connect
import it.gerdavax.easybluetooth.RemoteDevice; //导入依赖的package包/类
protected void connect(final String address){
if (address == null) return;
localDevice = LocalDevice.getInstance();
localDevice.init(this, new ReadyListener() {
@Override
public void ready() {
RemoteDevice device = localDevice.getRemoteForAddr(address);
localDevice.destroy();
new ConnectThread(device).start();
}
});
}
示例3: onStart
import it.gerdavax.easybluetooth.RemoteDevice; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
localDevice.init(this, new ReadyListener(){
@Override
public void ready() {
localDevice.scan(new ScanListener(){
@Override
public void deviceFound(RemoteDevice device) {
synchronized(adapter.discoveredDevices){
Vector<RemoteDevice> addedDevices = adapter.discoveredDevices;
for (RemoteDevice rd : addedDevices){
if (rd.getAddress().equals(device.getAddress())){
Log.d(TAG, "device already in list -> renew");
adapter.discoveredDevices.remove(rd);
}
}
adapter.discoveredDevices.add(device);
}
adapter.notifyDataSetChanged();
}
@Override
public void scanCompleted() {
setProgressBarIndeterminateVisibility(false);
}
});
} // end ready()
});
}
示例4: onListItemClick
import it.gerdavax.easybluetooth.RemoteDevice; //导入依赖的package包/类
@Override
protected void onListItemClick(ListView lv, View view, int position, long id) {
super.onListItemClick(lv, view, position, id);
// since user selected already a device we do not need to scan for more devices
localDevice.stopScan();
final String address = ((RemoteDevice)adapter.getItem(position)).getAddress();
Intent i = new Intent();
i.putExtra(ADDRESS_EXTRA, address);
setResult(RESULT_OK, i);
finish();
}
示例5: ConnectThreadArduino
import it.gerdavax.easybluetooth.RemoteDevice; //导入依赖的package包/类
public ConnectThreadArduino(RemoteDevice device) {
mDevice = device;
Log.d("Shimmer", " Start of ArduinoConnectThread");
}
示例6: ConnectThread
import it.gerdavax.easybluetooth.RemoteDevice; //导入依赖的package包/类
public ConnectThread(RemoteDevice device) {
mDevice = device;
}
示例7: BTDevice
import it.gerdavax.easybluetooth.RemoteDevice; //导入依赖的package包/类
public BTDevice(RemoteDevice rd){
this.address = rd.getAddress();
this.name = rd.getFriendlyName();
}