Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement set and get bluetooth of devices. #790

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JeannedArk
Copy link

This contributes to the server side, see this ticket:
openstf/STFService.apk#18
and the corresponding pull request:
openstf/STFService.apk#20

The STFService.apk was updated to the changes in the pull request in order to be able to set and get the Bluetooth status. The .proto files have been adjusted. The functionality was very similiar implemented to the WiFi functionality. Like for WiFi, similiar buttons have been added to the Device->Automation view.

Be aware, that setting and getting the Bluetooth status is only possible with the new updated .apk, otherwise a timeout occurs.

@@ -67,6 +67,8 @@ enum MessageType {
RingerGetMessage = 64;
WifiSetEnabledMessage = 57;
WifiGetStatusMessage = 58;
BluetoothSetEnabledMessage = 94;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those lines should be after line 82 with ConnectStoppedMessage.

@JeannedArk
Copy link
Author

Rebased and fixed that issue

.col-md-4
h6(translate) Bluetooth
.btn-group
label.btn.btn-sm.btn-primary-outline(ng-model='bluetoothEnabled', ng-click='toggleBluetooth(false)', uib-btn-radio='false', uib-tooltip='{{"Disable WiFi" | translate}}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tooltips still refer to WiFi

@sorccu
Copy link
Member

sorccu commented Jul 23, 2018

I tested this on a Huawei Mate 10 just now. It does work, however there's a bug. When bluetooth is disabled, and you use the STF UI to enable it, bluetooth gets enabled just fine. However, after a few seconds the STF UI shows that bluetooth is disabled. So, in other words, when you click on the "enable" button, it works and looks fine for a brief moment ("enable" button is blue). But then the "enable" button deactivates and the "disable" button becomes blue. If I go to another tab in STF and then back to the "Automation" tab, it shows correctly again ("enable" is blue). Maybe some sort of a timing issue?

By the way on the Mate 10 there's a dialog that pops up on the device every time you enable Bluetooth. It says "STFService is trying to turn on Bluetooth. Allow?" Might be related and/or causing the timing issue

@sorccu
Copy link
Member

sorccu commented Jul 23, 2018

I have merged openstf/STFService.apk#20 now. I believe that the bug I mentioned is related to the changes here. Note that you'll also have to bump the STFService version as follows:

diff --git lib/units/device/resources/service.js lib/units/device/resources/service.js
index 17eaaae9..7f1f1e38 100644
--- lib/units/device/resources/service.js
+++ lib/units/device/resources/service.js
@@ -17,7 +17,7 @@ module.exports = syrup.serial()
       pathutil.vendor('STFService/wire.proto'))

     var resource = {
-      requiredVersion: '2.3.0'
+      requiredVersion: '2.4.0'
     , pkg: 'jp.co.cyberagent.stf'
     , main: 'jp.co.cyberagent.stf.Agent'
     , apk: pathutil.vendor('STFService/STFService.apk')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants