bluetooth2020. 2. 13. 16:04

 

아래의 artcle 참조할 MAX MTU LE 5.0 vs LE 4.2(4.0) 차이에 대한 설명이 자세히 기록되어 있음.

 

https://interrupt.memfault.com/blog/ble-throughput-primer#bluetooth-low-energy-packet-structure

Posted by easy16
bluetooth2019. 11. 7. 16:27

 

해당 BLUETOOTH_PRIVILEGED  권한을 갖기 위해선 아래와 같이 system 권한이 필요.

 

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:sharedUserId="android.uid.system"
package="~~~>

 

BLUETOOTH_PRIVILEGED permission을 추가하고, priv-app에 넣고 빌드를 하게 될 경우, zygote에서 crash가 발생하게 된다. (부팅이 안됨)

 

 

#로그 확인하여 체크할 있음.

PackageManager: Privileged permission {PERMISSION_NAME} for package {PACKAGE_NAME} - not in privapp-permissions whitelist

 

#아래와 같이 whitelisting 필요.

https://source.android.google.cn/devices/tech/config/perms-whitelist?hl=ko

 

 

Android studio에서 빌드 시, platform key signed 이 되어 있어야 system 권한을 줄 수 있음.

keystore 생성 후, default.keystore or debug.keystore 를 replace 해준다. (기존 것은 backup해둘 것)

 

openssl pkcs8 -in platform.pk8 -inform DER -outform PEM -out platform.priv.pem -nocrypt
openssl pkcs12 -export -in platform.x509.pem -inkey platform.priv.pem -out platform.pk12 -name AndroidDebugKey
keytool -importkeystore -destkeystore platform.jks -srckeystore platform.pk12 -srcstoretype PKCS12 -srcstorepass android -alias AndroidDebugKey

 

 

 

'bluetooth' 카테고리의 다른 글

LE MTU에 관한 article  (0) 2020.02.13
Sample rate, Bit depth, Bit rate란  (0) 2018.09.27
bluetooth 코덱 비교에 관한 글  (0) 2018.09.27
LE scan 관련 tips (startScan 및 startLeScan이 안될 때)  (0) 2018.08.09
BLE 기본 용어  (0) 2018.08.07
Posted by easy16
bluetooth2018. 9. 27. 15:40

용어 정리


Sampling Rate -> 데이터를 추출하기 위한 계단의 갯수 (frequency)

Bit depth -> 내가 알고 있는 sampling resolution. 계단이 표현 가능한 범위.

Bit rate -> 말그대로 초당 bit의 갯수 (320kbps , 192kbps , 128kbps) 

         -> 만드는 방법 원래의 음원에서 특정 주파수의 내용을 제거하는 방식, 옛날 흔히 용량 문제로 만들던 MP3 파일을 다운사이징 하는 것.


Sampling Rate


The higher the sampling rate, the more steps used to approximate the curve, 

and the closer the digital signal sounds to the original sine wave.

ie:

When you are using a digital format, it is always an approximation of the analog sine wave, so a higher sampling rate will improve the sound quality, up to a point. 

There is a point where our ears cannot detect the difference anymore, because the sounds are outside of our hearing range.

Commonly seen sampling rates are 44.1KHz, 48KHz, 96KHz etc

Frequency is measured in Hertz, or cycles per second. 44.1KHz, 

is 44100 cycles per second.




Bit Depth (commonly 8 bit, 16 bit, 24 bit or 32 bit)


Bit depth is different, but also related to digital sound. Using a higher bit depth results in more precise sound calculations.

When you are merging, mixing, multiplying or synthesizing sounds, there are a lot of floating point calculations going on, ie lots of decimal places.

Each individual sound is an approximation of an analog sine wave, so if the calculations are not precise enough, distortion, or unwanted noise will appear in the signal.



Bit Rate (more info here)


Bit rate is measured in bits per second, most commonly kbps, for MP3 files.

The higher the bit rate, the better the sound quality, up to the point that our ears can detect it.

If you compare 320kbps or 192kbps MP3 files, they often sound similar to most people, but it you compare 320kbps to 128kbps, the 128kbps MP3 sounds tinny, hollow, lots of treble, little bass, like a radio with small speakers, versus a surround sound system.

A higher bit rate results in a larger file size, and better sound quality.

Lower bit rates are achieved by subtracting some of the frequencies in the sound, starting with frequencies outside our hearing range. This is why a reduction from a high bit rate to a slightly lower one doesn’t make a huge difference for most people.

It is only once you start culling frequencies that provide depth or audio richness in the sound, that you start to notice the loss in overall audio quality.

If you reduce the quality too far, the music sounds like you are listening to it through a telephone, which is significantly worse than the CD quality or live reproduction.

Digital representations sound or feel different to true analog sine waves, so a process called oversampling is often used to reduce distortion. 

You can read about sampling, bit depth and oversampling in more detail here.



출처 : 

https://www.quora.com/What-are-the-Sampling-rate-Bit-depth-and-Bit-rate-related-to-MP3-files-and-how-do-they-affect-the-quality-of-the-output-sound

'bluetooth' 카테고리의 다른 글

LE MTU에 관한 article  (0) 2020.02.13
BLUETOOTH_PRIVILEGED permission.  (0) 2019.11.07
bluetooth 코덱 비교에 관한 글  (0) 2018.09.27
LE scan 관련 tips (startScan 및 startLeScan이 안될 때)  (0) 2018.08.09
BLE 기본 용어  (0) 2018.08.07
Posted by easy16
bluetooth2018. 9. 27. 12:04


AAC bypass win


하기 참조:

http://goldenears.net/board/ST_KnowledgeBase/5181006

Posted by easy16
bluetooth2018. 8. 9. 16:27

Android L 이후 BluetoothAdapter의 startLeScan 이 동작하지 않는다.



1,해결 책으로 먼저 아래와 같이 BluetoothLeScanner를 BluetoothAdapter로 부터 얻어온다.

mBluetoothAdapter =BluetoothAdapter.getDefaultAdapter();
mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();


2, ScanFilter와 ScanSettings를 입맛에 맞게 설정한다.

settings = new ScanSettings.Builder().setScanMode(
ScanSettings.SCAN_MODE_LOW_LATENCY)
.setReportDelay(0)
.setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES)
.build();

filters = new ArrayList<ScanFilter>();
ScanFilter filter = new ScanFilter.Builder().setDeviceName("device명");

3,아래 처럼 startScan을 호출한다.

//mBluetoothLeScanner.startScan(filters, settings, mScanCallback);
mBluetoothLeScanner.startScan(mScanCallback);


동작이 안되는 경우는 두가지 케이스가 있다. 


그럴 땐 onCreate에 ACCESS_COARSE_LOCATION 을 아래와 같이 추가해주자.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 0);
}


이렇게 했는데도 ScanCallback 호출이 안된다?


그러면 Settings로 들어가 Location을 On 시키자. 그럼 된다.


어느 순간부터 구글이 멋대로 GMS에 Location기능에 GPS 및 bluetooth를 이용한 위치추적을 실시하고 있다.

웃기는건 Location을 Off로 만들어도 background로 Le scanning을 하고 있어 좀 구린 디바이스에는 성능 이슈를 야기하고 있다.



'bluetooth' 카테고리의 다른 글

Sample rate, Bit depth, Bit rate란  (0) 2018.09.27
bluetooth 코덱 비교에 관한 글  (0) 2018.09.27
BLE 기본 용어  (0) 2018.08.07
Remote voice recognition in latest Android  (0) 2018.08.07
SIMULTANEOUS USE OF A2DP and HFP/HSP in android  (0) 2018.08.07
Posted by easy16
bluetooth2018. 8. 7. 18:11

Key terms and concepts


GATT (Generic Attribute Profile) :

-GATT 프로파일은 BLE 링크를 통해 "attribute"으로 알려진 짧은 데이터 조각을 송수신하기위한 일반적인 사양입니다. 현재의 모든 저에너지 애플리케이션 프로파일은 GATT를 기반으로합니다.


Attribute Protocol (ATT) : 

-GATT is built on top of the Attribute Protocol (ATT).

-This is also referred to as GATT/ATT. ATT is optimized to run on BLE devices. To this end, it uses as few bytes as possible. 

-Each attribute is uniquely identified by a Universally Unique Identifier (UUID), which is a standardized 128-bit format for a string ID used to uniquely identify information. The attributes transported by ATT are formatted as characteristics and services.


Characteristic :

A characteristic contains a single value and 0-n descriptors that describe the characteristic's value. A characteristic can be thought of as a type, analogous to a class. 


Descriptor:

-Descriptors are defined attributes that describe a characteristic value. 

For example, a descriptor might specify a human-readable description, an acceptable range for a characteristic's value, or a unit of measure that is specific to a characteristic's value


Service:

-service is a collection of characteristics.

-For example, you could have a service called "Heart Rate Monitor" that includes characteristics such as "heart rate measurement."

You can find a list of existing GATT-based profiles and services on bluetooth.org.



Roles and responsibilities


Central vs. peripheral. 

GATT server vs. GATT client


출처:


Posted by easy16
bluetooth2018. 8. 7. 17:15

 구글에서 최신 Android 부터는 GATT service(BLE)를 사용하는 음성 인식을 사용하려는 움직임을 보였다.

이렇게 될 경우, 앞으로 Android TV 제품에 사용되는 모든 Remote를 Device vendor에 상관없이 사용할 수 있는 장점이 있다.

MW 입장에서도 application을 한번만 개발해 놓으면 되므로 좋은 방향으로 보인다.


Posted by easy16
bluetooth2018. 8. 7. 17:11


Nexus6 확인해보니, Android Device의 A2DP 및 HFP가 enable 되어있으며, 각각의 경우 사용이 가능하다.


아래의 경로에서 각 profile을 enable 할 수 있다.


packages/apps/Bluetooth/res/values/config.xml


<bool name="profile_supported_a2dp">true</bool>

<bool name="profile_supported_a2dp_sink">false</bool>

<bool name="profile_supported_hdp">true</bool>

<bool name="profile_supported_hs_hfp">true</bool>


문제는 startBluetoothSco를 호출하여 HFP service를 사용할 경우 A2DP 는 suspend 상태가 된다는 것이다.

구글링을 통해 본 대부분의 문서에서 A2DP와 HFP는 exclusive하게 동작한다는 것을 확인하였다.


https://e2e.ti.com/support/wireless_connectivity/bluetooth_cc256x/f/660/t/585944 


물론 동시 사용이 가능한 Device도 있는 것으로 보이지만,

Android의 경우 AudioPolicyManager에서 A2DP를 stop 시키므로

기본정책을 위배하면서까지 테스트 하는 risk를 감당할 이유는 없다.


아무래도 Piconet 특성상 제한된 대역폭 내에서 bidirectional로 동작하는 SCO 및 A2DP를 사용할 경우.

예상 및 해결이 불가능한 issue를 양산할 확률이 높을 것으로 예상된다.

'bluetooth' 카테고리의 다른 글

BLE 기본 용어  (0) 2018.08.07
Remote voice recognition in latest Android  (0) 2018.08.07
Profile 별 특징 비교  (0) 2018.08.06
UHID: User-Space HID I/O drivers  (0) 2018.07.04
android hci debugging tip (실시간 패킷 보기)  (0) 2018.06.27
Posted by easy16
bluetooth2018. 8. 6. 17:37

https://www.silabs.com/documents/login/presentations/Developing-Bluetooth-Audio.pdf

Posted by easy16
bluetooth2018. 7. 4. 16:28

https://dvdhrm.wordpress.com/2012/07/16/uhid-user-space-hid-io-drivers/ 

'bluetooth' 카테고리의 다른 글

SIMULTANEOUS USE OF A2DP and HFP/HSP in android  (0) 2018.08.07
Profile 별 특징 비교  (0) 2018.08.06
android hci debugging tip (실시간 패킷 보기)  (0) 2018.06.27
Bluetooth 5.0 주요 변경사항.  (0) 2018.06.21
bluetooth audio codec  (0) 2018.06.21
Posted by easy16