蓝牙术语与缩写详解:降低功耗的关键模式

需积分: 0 23 下载量 149 浏览量 更新于2024-08-08 收藏 878KB PDF 举报
本文档深入探讨了蓝牙术语和缩写在技术交流中的关键作用,特别是针对Sniff和Sniff-Sub-rating这两种在蓝牙设备间通信中常用的节能模式。主要内容包括: 1. **术语和缩写解析**: - ACL (Asynchronous Connection-oriented): 面向连接的异步传输链路,是蓝牙中常见的数据传输方式,大部分非音频应用采用这种模式,比如数据交换和通知。 - eSCO (Extended Synchronous Connection-Oriented): 扩展的同步连接链路,可能是为了提供更高效的流服务,但具体与SCO的区别没有详细说明。 - FHS (Frequency Hop Synchronization packet): 跳频同步包,用于确保蓝牙主设备和从设备之间的时钟同步,确保数据传输的精确性。 - HCI (Host Controller Interface): 主机控制接口,位于基带层之上,允许上层应用程序与底层硬件解耦,进行控制操作。 - HF (Hands Free device role of the HFP): HFP的免提设备角色,涉及到免提通话功能。 - HFP (Hands-Free Profile): 免提Profile,定义了蓝牙设备如何支持免提通话的功能标准。 - L2CAP (Logical Link Control and Adaptation Protocol): 逻辑链路控制和适配协议,它在管理层级提供服务,但不在应用层。 - LMP (Link Manager Protocol): 链路管理协议,负责创建、修改和释放蓝牙逻辑连接,维持连接状态。 - LT_ADDR (Logical Transport Address): 逻辑传输地址,用于标识蓝牙设备在逻辑链路上的身份。 2. **Sniff模式和Sniff-Sub-rating模式**: - Sniff模式是一种低功耗通信模式,通过监听而非主动发送数据来节省能量。 - Sniff-Sub-rating是Sniff模式的一种扩展,可能涉及更精细的控制和功率管理,旨在进一步优化能源效率。 - 文档详细介绍了进入Sniff模式的过程、参数选择以及与Sniff-Sub-rating模式之间的切换和同步方法。 3. **应用场景与节能优势**: - Sniff和Sniff-Sub-rating模式适用于蓝牙设备在无需持续数据传输时,如待机状态下保持连接,从而显著降低电池消耗。 通过理解这些术语和模式,蓝牙设备设计者和用户能够更好地管理设备的通信策略,提高能效,并根据具体需求选择合适的通信模式。文档还引用了蓝牙核心规格版本,为深入研究提供了官方参考资料。

修改下面代码,另画一张可视化图展示出t_sne里面的数据每15行数据个用一种颜色画出。 import pandas as pd from sklearn import cluster from sklearn import metrics import matplotlib.pyplot as plt from sklearn.manifold import TSNE from sklearn.decomposition import PCA def k_means(data_set, output_file, png_file, t_labels, score_file, set_name): model = cluster.KMeans(n_clusters=7, max_iter=1000, init="k-means++") model.fit(data_set) # print(list(model.labels_)) p_labels = list(model.labels_) r = pd.concat([data_set, pd.Series(model.labels_, index=data_set.index)], axis=1) r.columns = list(data_set.columns) + [u'聚类类别'] print(r) # r.to_excel(output_file) with open(score_file, "a") as sf: sf.write("By k-means, the f-m_score of " + set_name + " is: " + str(metrics.fowlkes_mallows_score(t_labels, p_labels))+"\n") sf.write("By k-means, the rand_score of " + set_name + " is: " + str(metrics.adjusted_rand_score(t_labels, p_labels))+"\n") '''pca = PCA(n_components=2) pca.fit(data_set) pca_result = pca.transform(data_set) t_sne = pd.DataFrame(pca_result, index=data_set.index)''' t_sne = TSNE() t_sne.fit(data_set) t_sne = pd.DataFrame(t_sne.embedding_, index=data_set.index) plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False dd = t_sne[r[u'聚类类别'] == 0] plt.plot(dd[0], dd[1], 'r.') dd = t_sne[r[u'聚类类别'] == 1] plt.plot(dd[0], dd[1], 'go') dd = t_sne[r[u'聚类类别'] == 2] plt.plot(dd[0], dd[1], 'b*') dd = t_sne[r[u'聚类类别'] == 3] plt.plot(dd[0], dd[1], 'o') dd = t_sne[r[u'聚类类别'] == 4] plt.plot(dd[0], dd[1], 'm.') dd = t_sne[r[u'聚类类别'] == 5] plt.plot(dd[0], dd[1], 'co') dd = t_sne[r[u'聚类类别'] == 6] plt.plot(dd[0], dd[1], 'y*') plt.savefig(png_file) plt.clf() '''plt.scatter(data_set.iloc[:, 0], data_set.iloc[:, 1], c=model.labels_) plt.savefig(png_file) plt.clf()''' frog_data = pd.read_csv("D:/PyCharmPython/pythonProject/mfcc3.csv") tLabel = [] for family in frog_data['name']: if family == "A": tLabel.append(0) elif family == "B": tLabel.append(1) elif family == "C": tLabel.append(2) elif family == "D": tLabel.append(3) elif family == "E": tLabel.append(4) elif family == "F": tLabel.append(5) elif family == "G": tLabel.append(6) scoreFile = "D:/PyCharmPython/pythonProject/scoreOfClustering.txt" first_set = frog_data.iloc[:, 1:1327] k_means(first_set, "D:/PyCharmPython/pythonProject/kMeansSet_1.xlsx", "D:/PyCharmPython/pythonProject/kMeansSet_2.png", tLabel, scoreFile, "Set_1")

2023-07-12 上传

在下面代码中修改添加一个可视化图,用来画出r经过t_sne之后前15行和15到30行数据的可视化图。import pandas as pd from sklearn import cluster from sklearn import metrics import matplotlib.pyplot as plt from sklearn.manifold import TSNE from sklearn.decomposition import PCA def k_means(data_set, output_file, png_file, png_file1, t_labels, score_file, set_name): model = cluster.KMeans(n_clusters=7, max_iter=1000, init="k-means++") model.fit(data_set) # print(list(model.labels_)) p_labels = list(model.labels_) r = pd.concat([data_set, pd.Series(model.labels_, index=data_set.index)], axis=1) r.columns = list(data_set.columns) + [u'聚类类别'] print(r) # r.to_excel(output_file) with open(score_file, "a") as sf: sf.write("By k-means, the f-m_score of " + set_name + " is: " + str(metrics.fowlkes_mallows_score(t_labels, p_labels))+"\n") sf.write("By k-means, the rand_score of " + set_name + " is: " + str(metrics.adjusted_rand_score(t_labels, p_labels))+"\n") '''pca = PCA(n_components=2) pca.fit(data_set) pca_result = pca.transform(data_set) t_sne = pd.DataFrame(pca_result, index=data_set.index)''' t_sne = TSNE() t_sne.fit(data_set) t_sne = pd.DataFrame(t_sne.embedding_, index=data_set.index) plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False dd = t_sne[r[u'聚类类别'] == 0] plt.plot(dd[0], dd[1], 'r.') dd = t_sne[r[u'聚类类别'] == 1] plt.plot(dd[0], dd[1], 'go') dd = t_sne[r[u'聚类类别'] == 2] plt.plot(dd[0], dd[1], 'b*') dd = t_sne[r[u'聚类类别'] == 3] plt.plot(dd[0], dd[1], 'o') dd = t_sne[r[u'聚类类别'] == 4] plt.plot(dd[0], dd[1], 'm.') dd = t_sne[r[u'聚类类别'] == 5] plt.plot(dd[0], dd[1], 'co') dd = t_sne[r[u'聚类类别'] == 6] plt.plot(dd[0], dd[1], 'y*') plt.savefig(png_file) plt.clf() '''plt.scatter(data_set.iloc[:, 0], data_set.iloc[:, 1], c=model.labels_) plt.savefig(png_file) plt.clf()''' frog_data = pd.read_csv("D:/PyCharmPython/pythonProject/mfcc3.csv") tLabel = [] for family in frog_data['name']: if family == "A": tLabel.append(0) elif family == "B": tLabel.append(1) elif family == "C": tLabel.append(2) elif family == "D": tLabel.append(3) elif family == "E": tLabel.append(4) elif family == "F": tLabel.append(5) elif family == "G": tLabel.append(6) scoreFile = "D:/PyCharmPython/pythonProject/scoreOfClustering.txt" first_set = frog_data.iloc[:, 1:1327] k_means(first_set, "D:/PyCharmPython/pythonProject/kMeansSet_1.xlsx", "D:/PyCharmPython/pythonProject/kMeansSet_2.png", "D:/PyCharmPython/pythonProject/kMeansSet_2_1.png", tLabel, scoreFile, "Set_1")

2023-07-12 上传