마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

Android 4.3 Bluetooth Low Energy 장치 해제 이벤트 20초 후 발생

0 추천

Android 4.3 Bletooth Low Energy로 연결후 remote 장치 전원 오프 하는 경우..

20초 이후에 onConnectionStateChange 메소드에  BluetoothProfile.STATE_DISCONNECTED  가 발생 합니다.

연결 해제 이벤트를 바로 처리 하는 방법을 알고 싶습니다... 감사합니다.

 

 

    private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
        
        @Override
        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
            String intentAction;
            if (newState == BluetoothProfile.STATE_CONNECTED) {
                intentAction = ACTION_GATT_CONNECTED;
                mConnectionState = STATE_CONNECTED;
                broadcastUpdate(intentAction);
                Log.i(TAG, "Connected to GATT server.");
                // Attempts to discover services after successful connection.
                Log.i(TAG, "Attempting to start service discovery:" +
                
                mBluetoothGatt.discoverServices());
 
            } else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
                intentAction = ACTION_GATT_DISCONNECTED;
                mConnectionState = STATE_DISCONNECTED;
                Log.i(TAG, "Disconnected from GATT server.");
                broadcastUpdate(intentAction);
            }
        }
 
...
};
mu8454 (220 포인트) 님이 2013년 11월 13일 질문

1개의 답변

0 추천
BLE디바이스의 전원을 내릴때 BLE디바이스 쪽에서 Remote Disconnect를 해주지 않으면

단말쪽에서 눈치채기(?)까지는 시간이 걸립니다.

스택, 혹은 그 이하의 수정이 필요한 작업이라봅니다..
Seraph (1,520 포인트) 님이 2013년 11월 14일 답변
안녕하세요 질문이 있어서 이렇게 글을 올립니다.
제가 App과 Atmega를 BLE로 연동을 하는데요
BLE디바이스 쪽 즉 Atmega에서 통신을 통해 Disconnect되었다는 메세지를 APP으로 데이터를 전송하여 APP에서 데이터를 받으면 해지되게 만들어야 하는 말씀인가요? 혹시 관련된 정보가 있으면 공유를 부탁드립니다.
...