android 蓝牙学习小记
Android 蓝牙学习小记
这里面记录了一些开始学蓝牙是学到的一些小知识点,很零碎, 有的是自己总结,有的是从别的文章中摘抄的。
FTP与OPP协议
两个协议都是传文件的,但是两个协议传的文件有所不同。
- OPP协议传输特定格式的文件,在协议里定义了可以该协议可以接受哪些格式的文件,如下所示, 这些类型的文件接受到了后将按照文件的格式进行对应的解析。
/**
* The MIME type(s) of we could accept from other device.
* This is in essence a "white list" of acceptable types.
* Today, restricted to images, audio, video and certain text types.
*/
public static final String[] ACCEPTABLE_SHARE_INBOUND_TYPES = new String[] {
"image/*",
"video/*",
"audio/*",
"text/x-vcard",
"text/plain",
"text/html",
"text/xml",
"text/comma-separated-values",
"text/calendar",
"application/ogg",
"application/zip",
"application/vnd.ms-excel",
"application/msword",
"application/vnd.ms-powerpoint",
"application/pdf",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"application/x-hwp",
"application/vnd.android.package-archive",
};
- 其它类型的文件就由FTP协议进程传输,标准的文件传送,如果你用FTP协议传 "text/x-vcard"类型的文件,接受端只认为传送过来的是一个文件,并将这个文件保存。
而不会将其解成一个名片。
传统蓝牙服务端中常见协议列表
A2DP: Advanced Audio Distribution Profile
AVRCP: A/V Remote Control Profile
FTP: File Transfer Profile
HDP: Health Device Profile
HFP: Hands-Free Profile
HID : Human Interface Device Profile
HSP :Headset Profile
MAP: Message Access Profile
OPP