Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
fa78d283
Commit
fa78d283
authored
Apr 26, 2019
by
Jeong Gilmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#32917 芯温センサー
- 外部機器と接続について改善
parent
6bf700e7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BleManagerUtil.java
+15
-3
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
+1
-2
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/PairingSettingActivity.java
+1
-2
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/BleManagerUtil.java
View file @
fa78d283
...
...
@@ -18,10 +18,12 @@ import android.bluetooth.BluetoothGattService;
import
android.bluetooth.BluetoothManager
;
import
android.bluetooth.BluetoothProfile
;
import
android.content.Context
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.widget.Toast
;
import
static
android
.
bluetooth
.
BluetoothDevice
.
TRANSPORT_LE
;
import
static
org
.
chromium
.
base
.
ThreadUtils
.
runOnUiThread
;
public
class
BleManagerUtil
{
...
...
@@ -95,12 +97,15 @@ public class BleManagerUtil {
}
if
(
BluetoothProfile
.
STATE_DISCONNECTED
==
newState
)
{
// 切断完了(接続可能範囲から外れて切断された)
// 接続可能範囲に入ったら自動接続するために、mBluetoothGatt.connect()を呼び出す。
mBluetoothGatt
.
connect
();
// 接続可能範囲に入ったら自動接続することが必要場合、mBluetoothGatt.connect()を呼び出す。
// mBluetoothGatt.connect();
// 切断が発生する場合、Bluetoothと接続を切断する。
disconnect
();
runOnUiThread
(
new
Runnable
()
{
public
void
run
()
{
// 切断トーストメッセージを表示する。
listener
.
onDisConnectionState
();
//
listener.onDisConnectionState();
}
}
);
return
;
...
...
@@ -223,9 +228,16 @@ public class BleManagerUtil {
// mBluetoothGattのサービスと接続
BluetoothDevice
device
=
mBluetoothAdapter
.
getRemoteDevice
(
mDeviceAddress
);
// GATT BLEを利用する時Androidのバージョン「23」をチェックしてGATTと接続する。
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
mBluetoothGatt
=
device
.
connectGatt
(
context
,
false
,
mGattcallback
,
TRANSPORT_LE
);
}
else
{
mBluetoothGatt
=
device
.
connectGatt
(
context
,
false
,
mGattcallback
);
}
}
// 切断
public
void
disconnect
()
{
if
(
null
==
mBluetoothGatt
)
{
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
View file @
fa78d283
...
...
@@ -396,8 +396,7 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
// 接続されている機器と切断する。
if
(
null
!=
bleManagerUtil
.
mBluetoothGatt
)
{
bleManagerUtil
.
mBluetoothGatt
.
close
();
bleManagerUtil
.
mBluetoothGatt
=
null
;
bleManagerUtil
.
mBluetoothGatt
.
disconnect
();
putUserPref
(
AppDefType
.
UserPrefKey
.
BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED
,
0
);
}
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/PairingSettingActivity.java
View file @
fa78d283
...
...
@@ -259,8 +259,7 @@ public class PairingSettingActivity extends ABVUIActivity implements AdapterView
// Gattサービスがある場合、切断するためnullにする。
if
(
null
!=
bleManagerUtil
.
mBluetoothGatt
)
{
bleManagerUtil
.
mBluetoothGatt
.
close
();
bleManagerUtil
.
mBluetoothGatt
=
null
;
bleManagerUtil
.
mBluetoothGatt
.
disconnect
();
putUserPref
(
AppDefType
.
UserPrefKey
.
BLUETOOTH_DEVICE_TEMPERATURE_CONNECTED
,
0
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment