蓝牙传输协议类型

最近在和蓝牙耳机厂商联调,被各种各样的术语搞得头昏脑涨。

蓝牙芯片厂商主要有两家,一个是CSR,剑桥的一家公司,被高通24亿美元收购,,另一家BCM, 博通,美国公司,印象中很多网卡就是他们家的。

简单的来说 app与蓝牙设备之间传输数据主要有以下方式

基于CSR8670 4.0双模蓝牙模块,包含了A2DP(音乐播放),AVRCP(流媒体控制及音乐封面
传输),HFP(免提通话),SPP(数据传输),PBAPC(电话本同步),HID(鼠标),BLE DataTrans(低功耗模式下的小数据传输)等协议。模块上的VREG高电平开机、低电平关机,开机后自动连接最近连接的手机。蓝牙模块与MCU执行UART 通信,使用AT指令实现连接、断开、拨打电话、音乐播放及远程控制、下载电话本、数据传输等功能。方案因采用4.0双模式,无需MFI认证可以兼容安卓、苹果和微软等平台的数据通信

如何在SDK中集成第三方AAR包

我最近在开发一个面向企业内部app的语音SDK,在和思必驰的基础SDK集成的过程中发现,思必驰提供的sdk 是AAR文件,而我需要输出的也是aar,这时候发现思必驰的aar是没有办法打包到我的aar中的(调用方会找不到那个aar),试了通用的方法,比如

  flatDir {
    dirs 'libs'
  }

还是不能解决,最终想到的由第三方服务商解决办法有两个:

继续阅读“如何在SDK中集成第三方AAR包”

DialogFragment fill screen width

前一阵子做一个demo,想从底部弹出一个类似于dialog的布局,但是发现无论怎么发现两边都有一定留白(在android 8.1系统)搜索了一些资料,填埋了这个坑。
setStyle(DialogFragment.STYLE_NO_TITLE, R.style.Theme_Dialog)
val window = dialog.window
window.setGravity(Gravity.BOTTOM) //可设置dialog的位置
window.decorView.setPadding(0, 0, 0, 0)
window.setBackgroundDrawable(ColorDrawable(Color.WHITE));//这句话还不能少 日了狗
val lp = window.attributes
lp.width = WindowManager.LayoutParams.MATCH_PARENT //设置宽度充满屏幕
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
window.attributes = lp
window.attributes.windowAnimations = R.style.DialogAnimation

Install ShadowsocksR Clients on Linux(Ubuntu)

Start by installing on your Linux PC the prerequisite packages for ShadowsocksR:

sudo apt-get install git python-m2crypto libsodium18

We are going to install ShadowsocksR into our Downloads directory, so change into that directory if you need to:

cd ~/Downloads

Get ShadowsocksR from Github:

git clone -b manyuser https://github.com/shadowsocksrr/shadowsocksr.git

Note that long commands may appear on multiples lines on this web page, but you should enter them as a single command.

Edit your initial ShadowsocksR configuration file:

sudo vi /etc/shadowsocks.json

You can start with the template below. Of course, you must substitute in your values for the ShadowsocksR server IP address, port, password, encryption method, protocol, obfuscation method, and so on. Here is the template to start with:

{
"server":"12.34.56.78",
"server_ipv6":"::",
"server_port":8388,
"local_address":"127.0.0.1",
"local_port":1080,
"password":"happy2017",
"timeout":300,
"udp_timeout":60,
"method":"aes-128-ctr",
"protocol":"auth_aes128_md5",
"protocol_param":"",
"obfs":"tls1.2_ticket_auth",
"obfs_param":"",
"fast_open":false,
"workers":1
}

Press <strong>Esc</strong> if you need to escape from insert or replace mode. Type <strong>:wq</strong> to write the file to disk and quit the editor.

Change into the directory for the single-user version of SSR:

cd shadowsocksr/shadowsocks

Start the ShadowsocksR client running as a daemon:

sudo python local.py -c /etc/shadowsocks.json -d start

Check that it is running okay:

sudo tail /var/log/shadowsocksr.log

If you are using Firefox, configure it to send traffic to ShadowsocksR on localhost port 1080. You do this under Preferences>Advanced>Network>Settings. Make sure you also proxy your DNS traffic.

If you are using Chrome instead of Firefox, install the extension Proxy SwitchyOmega by FelisCatus, and configure it for a SOCKS5 proxy server on localhost port 1080.

When you have finished using ShadowsocksR, set Firefox or Chrome back to using the system proxy settings, and stop the daemon:

sudo python local.py -c /etc/shadowsocks.json -d stop

If you subsequently add a new server, you will need to edit the file/etc/shadowsocks.json and restart the daemon.

reference: https://dcamero.azurewebsites.net/shadowsocksr.html