首页 SEO优化 正文

蓝牙串口app开发(蓝牙串口app程序源码)

SEO优化 57 0

今天给各位分享蓝牙串口app开发的知识,其中也会对蓝牙串口app程序源码进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

求教如何制作一个安卓手机蓝牙制作的app程序,用于和单片机上的蓝牙模块,实现数据的传送

下位机,用串口和蓝牙模块连接,通信

上位机,安卓app开发用eclipse或者是android studio,蓝牙有相关的函数,,连接,断开,接受,网上大部分代码套着用就行了,,如果需要修改也修改的不多,,主ui界面的时候,不能有进程的占用和其他的一些的线程的操作,所以就得到子线程里面去执行了,还是先学学基础吧,之后再看这些的话,就容易的多了

spp蓝牙串口助手如何建立快捷发送

无法快送发送。spp蓝牙串口调试助手需要每一步来发送,无法快捷发送。spp蓝牙串口app是专为用户蓝牙进行连接而开发的手机调试服务网,网可以通过蓝牙连接来进行沟通,发送信息。

想开发一个类似于蓝牙串口助手的软件,设置几个按钮,点击相应按钮就发送相应字符串给蓝牙模块,求解答。

如此简单,干脆用流行的串口软件,如格西烽火串口助手、串口调试助手等,都可以轻松实现。

如何使用MIT APP Inventor2 快速创建一个蓝牙串口app

AppInventor开发工具与测试用的AI伴侣是同步更新的,因此某个版本的AI2要与特定版本的伴侣配合使用。你可以到新浪博客搜一下“老巫婆的博客”,置顶贴里有本土版离线包的下载地址,如果我没记错的话,离线包中自带的ai伴侣就是你需要的这个版本。另:最好稳定地使用某个版本一段时间,如果跟随MIT频繁地更新版本,会无端地生出一些麻烦。

android蓝牙开发,PC端模拟串口接收字符,该如何编程?

您好,android蓝牙这方面还是很好搞的,因为大家的方式都是差不多的。先说说如何开启蓝牙设备和设置可见时间:

private void search() {

BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();

if (!adapter.isEnabled()) {

adapter.enable();

}

Intent enable = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);

enable.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 3600); //3600为蓝牙设备可见时间

startActivity(enable);

Intent searchIntent = new Intent(this, ComminuteActivity.class);

startActivity(searchIntent);

}

首先,需要获得一个BluetoothAdapter,可以通过getDefaultAdapter()获得系统默认的蓝牙适配器,当然我们也可以自己指定,但这个真心没有必要,至少我是不需要的。然后我们检查手机的蓝牙是否打开,如果没有,通过enable()方法打开。接着我们再设置手机蓝牙设备的可见,可见时间可以自定义。

完成这些必要的设置后,我们就可以正式开始与蓝牙模块进行通信了:

public class ComminuteActivity extends Activity {

private BluetoothReceiver receiver;

private BluetoothAdapter bluetoothAdapter;

private ListString devices;

private ListBluetoothDevice deviceList;

private Bluetooth client;

private final String lockName = "BOLUTEK";

private String message = "000001";

private ListView listView;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.search_layout);

listView = (ListView) this.findViewById(R.id.list);

deviceList = new ArrayListBluetoothDevice();

devices = new ArrayListString();

bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

bluetoothAdapter.startDiscovery();

IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);

receiver = new BluetoothReceiver();

registerReceiver(receiver, filter);

listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

@Override

public void onItemClick(AdapterView? parent, View view, int position, long id) {

setContentView(R.layout.connect_layout);

BluetoothDevice device = deviceList.get(position);

client = new Bluetooth(device, handler);

try {

client.connect(message);

} catch (Exception e) {

Log.e("TAG", e.toString());

}

}

});

}

@Override

protected void onDestroy() {

unregisterReceiver(receiver);

super.onDestroy();

}

private final Handler handler = new Handler() {

@Override

public void handleMessage(Message msg) {

switch (msg.what) {

case Bluetooth.CONNECT_FAILED:

Toast.makeText(ComminuteActivity.this, "连接失败", Toast.LENGTH_LONG).show();

try {

client.connect(message);

} catch (Exception e) {

Log.e("TAG", e.toString());

}

break;

case Bluetooth.CONNECT_SUCCESS:

Toast.makeText(ComminuteActivity.this, "连接成功", Toast.LENGTH_LONG).show();

break;

case Bluetooth.READ_FAILED:

Toast.makeText(ComminuteActivity.this, "读取失败", Toast.LENGTH_LONG).show();

break;

case Bluetooth.WRITE_FAILED:

Toast.makeText(ComminuteActivity.this, "写入失败", Toast.LENGTH_LONG).show();

break;

case Bluetooth.DATA:

Toast.makeText(ComminuteActivity.this, msg.arg1 + "", Toast.LENGTH_LONG).show();

break;

}

}

};

private class BluetoothReceiver extends BroadcastReceiver {

@Override

public void onReceive(Context context, Intent intent) {

String action = intent.getAction();

if (BluetoothDevice.ACTION_FOUND.equals(action)) {

BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);

if (isLock(device)) {

devices.add(device.getName());

}

deviceList.add(device);

}

showDevices();

}

}

private boolean isLock(BluetoothDevice device) {

boolean isLockName = (device.getName()).equals(lockName);

boolean isSingleDevice = devices.indexOf(device.getName()) == -1;

return isLockName isSingleDevice;

}

private void showDevices() {

ArrayAdapterString adapter = new ArrayAdapterString(this, android.R.layout.simple_list_item_1,

devices);

listView.setAdapter(adapter);

}

}

蓝牙串口app开发的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于蓝牙串口app程序源码、蓝牙串口app开发的信息别忘了在本站进行查找喔。

扫码二维码