# BluetoothTools
**Repository Path**: jbxb/bluetooth-tools
## Basic Information
- **Project Name**: BluetoothTools
- **Description**: 私人用 物联网工具集
- **Primary Language**: Swift
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-01-13
- **Last Updated**: 2026-03-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 蓝牙测试工具 (Bluetooth Tools)
一个基于 iOS 的蓝牙测试应用,集成了多种蓝牙库和网络通信功能。
## 📋 项目简介
本项目是一个功能强大的 iOS 蓝牙测试工具,支持蓝牙低功耗 (BLE) 设备扫描、连接、数据传输,以及 WebSocket 通信功能。项目采用了多种成熟的第三方库来提供稳定的蓝牙和网络支持。
## ✨ 主要功能
- **蓝牙设备扫描**:发现周围的 BLE 设备
- **蓝牙连接管理**:连接和断开蓝牙设备
- **数据通信**:向蓝牙设备发送和接收数据
- **WebSocket 支持**:实时网络通信
- **键盘管理**:优化的输入体验
- **多语言支持**:支持简体中文、繁体中文和日语
## 🏗 项目结构
```
BuletoothTest/
├── AppDelegate.swift # 应用委托
├── SceneDelegate.swift # 场景委托 (iOS 13+)
├── ViewController.swift # 主视图控制器
├── Assets.xcassets/ # 应用资源
├── Base.lproj/ # 基础语言资源
├── ja.lproj/ # 日语资源
├── zh-Hans.lproj/ # 简体中文资源
└── zh-Hant.lproj/ # 繁体中文资源
```
## 📦 依赖库
本项目使用 CocoaPods 管理第三方依赖:
| 库名 | 用途 |
|------|------|
| **Alamofire** | 网络请求库,支持 HTTP、WebSocket 等 |
| **Bluejay** | 蓝牙低功耗 (BLE) 库,提供简洁的 API |
| **BluetoothKit** | 另一个蓝牙库,支持中心模式和外围模式 |
| **IQKeyboardManager** | 键盘管理工具,自动处理键盘遮挡 |
| **IQKeyboardNotification** | 键盘事件通知 |
| **IQKeyboardReturnManager** | 键盘返回键管理 |
## 🚀 快速开始
### 环境要求
- iOS 13.0+
- Xcode 12.0+
- CocoaPods 1.10.0+
### 安装步骤
1. 克隆项目:
```bash
git clone https://gitee.com/jbxb/bluetooth-tools.git
cd bluetooth-tools
```
2. 安装依赖:
```bash
pod install
```
3. 使用 Xcode 打开 `BuletoothTest.xcworkspace`
4. 运行项目
## 📱 功能说明
### 蓝牙操作
应用提供以下蓝牙功能:
- **扫描设备**:发现附近的 BLE 设备
- **连接设备**:建立与目标设备的连接
- **数据传输**:发送和接收数据
- **断开连接**:安全断开蓝牙连接
### 网络通信
- **WebSocket 连接**:支持实时双向通信
- **HTTP 请求**:使用 Alamofire 进行网络请求
## 🔧 配置说明
### Info.plist 权限配置
需要在 `Info.plist` 中添加蓝牙使用说明:
```xml
NSBluetoothAlwaysUsageDescription
需要使用蓝牙连接设备
NSBluetoothPeripheralUsageDescription
需要蓝牙外设权限
```
### 后台模式
如需后台蓝牙操作,请在 Capabilities 中启用 **Background Modes**:
- Bluetooth Central
- Bluetooth Peripheral
## 💻 核心代码
### ViewController 主要方法
```swift
// 蓝牙数据发送
func bluetoothSend()
// WebSocket 连接
func websoket()
// 按钮点击事件
func clickButton(_ sender: UIButton)
```
## 🌐 语言支持
项目内置多语言支持:
- ✅ 简体中文 (zh-Hans)
- ✅ 繁体中文 (zh-Hant)
- ✅ 日语 (ja)
## 📄 许可证
本项目使用 **MIT 许可证**。
## 🤝 贡献指南
欢迎提交 Issue 和 Pull Request。
## 📞 联系方式
- 项目地址:https://gitee.com/jbxb/bluetooth-tools
- 问题反馈:请在 Gitee 项目页面提交 Issue
## 🙏 致谢
感谢以下开源项目:
- [Alamofire](https://github.com/Alamofire/Alamofire)
- [Bluejay](https://github.com/steamclock/bluejay)
- [BluetoothKit](https://github.com/RahulKatari/BluetoothKit)
- [IQKeyboardManager](https://github.com/hackiftekhar/IQKeyboardManager)