appium_lib_core 4.3.0 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/unittest.yml +2 -2
- data/CHANGELOG.md +20 -2
- data/appium_lib_core.gemspec +4 -4
- data/ci-jobs/functional/run_appium.yml +2 -2
- data/ci-jobs/functional_test.yml +1 -1
- data/lib/appium_lib_core/common/base.rb +0 -1
- data/lib/appium_lib_core/common/base/bridge.rb +17 -102
- data/lib/appium_lib_core/common/base/bridge/w3c.rb +108 -13
- data/lib/appium_lib_core/common/base/capabilities.rb +3 -3
- data/lib/appium_lib_core/common/base/command.rb +123 -2
- data/lib/appium_lib_core/common/base/driver.rb +67 -21
- data/lib/appium_lib_core/common/base/has_location.rb +73 -0
- data/lib/appium_lib_core/common/base/has_network_connection.rb +56 -0
- data/lib/appium_lib_core/common/base/http_default.rb +1 -1
- data/lib/appium_lib_core/common/{command/mjsonwp.rb → base/remote_status.rb} +15 -12
- data/lib/appium_lib_core/common/command.rb +0 -1
- data/lib/appium_lib_core/common/device/image_comparison.rb +9 -1
- data/lib/appium_lib_core/device.rb +0 -4
- data/lib/appium_lib_core/driver.rb +13 -10
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +27 -0
- data/script/commands.rb +2 -25
- metadata +17 -21
- data/lib/appium_lib_core/common/base/bridge/mjsonwp.rb +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd462f64262abe99f03dd5a421f2a2dd9c8064f1d44eff47bc1872a834793d27
|
4
|
+
data.tar.gz: 1a1ca492c3551d8c992e9f2b740460e67239887400602351423062e49912b73f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9e4977dfb93ce734c59af5053a6331bfc2038bd3a03757a31fd7e48c3cdcc810204fb6f3027a1120afe91eda31ad61aa504fa25fdf2a2a21d36638c27982f8e
|
7
|
+
data.tar.gz: 3e23c561984a3ad4bf4214aad79fc730f8673d0bc29c81d26ff5143c0dbeb38d6eacc9278ba0caa11e4dfc51f82267f79b97efe6937ad8315c837e64876df162
|
@@ -11,7 +11,7 @@ jobs:
|
|
11
11
|
strategy:
|
12
12
|
fail-fast: false
|
13
13
|
matrix:
|
14
|
-
ruby: [2.
|
14
|
+
ruby: [2.5, 2.6, 2.7, 3.0]
|
15
15
|
|
16
16
|
runs-on: ubuntu-latest
|
17
17
|
|
@@ -38,7 +38,7 @@ jobs:
|
|
38
38
|
fail-fast: false
|
39
39
|
matrix:
|
40
40
|
# Does not add 2.7 on Windows so far since a command fails only on Windows
|
41
|
-
ruby: [2.
|
41
|
+
ruby: [2.5, 2.6]
|
42
42
|
|
43
43
|
runs-on: windows-latest
|
44
44
|
|
data/CHANGELOG.md
CHANGED
@@ -10,15 +10,33 @@ Read `release_notes.md` for commit level details.
|
|
10
10
|
|
11
11
|
### Deprecations
|
12
12
|
|
13
|
-
## [
|
13
|
+
## [5.0.0.beta1]
|
14
|
+
|
15
|
+
- Update base selenium webdriver version to `4.0.0.beta2`
|
16
|
+
- Support only W3C spec
|
17
|
+
- Support Ruby 2.5+
|
18
|
+
|
19
|
+
## [4.5.0] - 2021-03-14
|
14
20
|
|
15
21
|
### Enhancements
|
16
|
-
- Add `
|
22
|
+
- Add `speed` argument for `Appium::Core::Base::Driver#set_location` since Appium 1.21.0
|
23
|
+
- Add `multiple` and `match_neighbour_threshold` arguments for `Appium::Core::Base::Driver#find_image_occurrence`
|
17
24
|
|
18
25
|
### Bug fixes
|
19
26
|
|
20
27
|
### Deprecations
|
21
28
|
|
29
|
+
|
30
|
+
## [4.4.1(4.4.0)] - 2021-02-15(2021-02-13)
|
31
|
+
|
32
|
+
### Enhancements
|
33
|
+
- Returns `{}` any errors in `Core#appium_server_version` to prevent errors in some cases
|
34
|
+
|
35
|
+
## [4.3.1(4.3.0)] - 2021-02-07(2021-02-05)
|
36
|
+
|
37
|
+
### Enhancements
|
38
|
+
- Add `start_recording_screen` for Mac2 driver
|
39
|
+
|
22
40
|
## [4.2.1] - 2021-01-10
|
23
41
|
|
24
42
|
### Enhancements
|
data/appium_lib_core.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'appium_lib_core/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.required_ruby_version = '>= 2.
|
7
|
+
spec.required_ruby_version = '>= 2.5'
|
8
8
|
|
9
9
|
spec.name = 'appium_lib_core'
|
10
10
|
spec.version = Appium::Core::VERSION
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_runtime_dependency 'selenium-webdriver', '
|
25
|
+
spec.add_runtime_dependency 'selenium-webdriver', '4.0.0.beta2'
|
26
26
|
spec.add_runtime_dependency 'faye-websocket', '~> 0.11.0'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler', '>= 1.14'
|
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
31
31
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
32
32
|
spec.add_development_dependency 'minitest-reporters', '~> 1.1'
|
33
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
34
|
-
spec.add_development_dependency 'rubocop', '1.
|
33
|
+
spec.add_development_dependency 'webmock', '~> 3.12.1'
|
34
|
+
spec.add_development_dependency 'rubocop', '1.11.0'
|
35
35
|
spec.add_development_dependency 'appium_thor', '~> 1.0'
|
36
36
|
spec.add_development_dependency 'pry'
|
37
37
|
spec.add_development_dependency 'pry-byebug'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
steps:
|
2
2
|
- task: NodeTool@0
|
3
3
|
inputs:
|
4
|
-
versionSpec:
|
5
|
-
displayName: Install Node
|
4
|
+
versionSpec: 12.x
|
5
|
+
displayName: Install Node 12.x
|
6
6
|
- script: npm install -g appium@${APPIUM_VERSION}
|
7
7
|
displayName: Install appium beta
|
8
8
|
- script: npm install -g mjpeg-consumer
|
data/ci-jobs/functional_test.yml
CHANGED
@@ -4,7 +4,7 @@ parameters:
|
|
4
4
|
vmImageForIOS: 'macOS-10.15' # Not sure the reason, but macOS 10.14 instance raises no info.plist error
|
5
5
|
xcodeForIOS: 12.2
|
6
6
|
xcodeForTVOS: 12.2
|
7
|
-
androidSDK: 30
|
7
|
+
androidSDK: 29 # API Level 30 emulators are more unstable than 29
|
8
8
|
appiumVersion: 'beta'
|
9
9
|
ignoreVersionSkip: true
|
10
10
|
CI: true
|
@@ -34,7 +34,6 @@ require_relative 'device/orientation'
|
|
34
34
|
# The following files have selenium-webdriver related stuff.
|
35
35
|
require_relative 'base/driver'
|
36
36
|
require_relative 'base/bridge'
|
37
|
-
require_relative 'base/bridge/mjsonwp'
|
38
37
|
require_relative 'base/bridge/w3c'
|
39
38
|
require_relative 'base/capabilities'
|
40
39
|
require_relative 'base/http_default'
|
@@ -16,52 +16,16 @@ module Appium
|
|
16
16
|
module Core
|
17
17
|
class Base
|
18
18
|
class Bridge < ::Selenium::WebDriver::Remote::Bridge
|
19
|
+
# TODO: Move W3C module to here
|
20
|
+
|
19
21
|
# Prefix for extra capability defined by W3C
|
20
22
|
APPIUM_PREFIX = 'appium:'
|
21
23
|
|
22
|
-
# TODO: Remove the forceMjsonwp after Appium server won't need it
|
23
|
-
FORCE_MJSONWP = :forceMjsonwp
|
24
|
-
|
25
|
-
# Almost same as self.handshake in ::Selenium::WebDriver::Remote::Bridge
|
26
|
-
#
|
27
|
-
# Implements protocol handshake which:
|
28
|
-
#
|
29
|
-
# 1. Creates session with driver.
|
30
|
-
# 2. Sniffs response.
|
31
|
-
# 3. Based on the response, understands which dialect we should use.
|
32
|
-
#
|
33
|
-
# @return [Bridge::MJSONWP, Bridge::W3C]
|
34
|
-
#
|
35
|
-
def self.handshake(**opts)
|
36
|
-
desired_capabilities = opts.delete(:desired_capabilities) { ::Selenium::WebDriver::Remote::Capabilities.new }
|
37
|
-
|
38
|
-
if desired_capabilities.is_a?(Symbol)
|
39
|
-
unless ::Selenium::WebDriver::Remote::Capabilities.respond_to?(desired_capabilities)
|
40
|
-
raise ::Selenium::WebDriver::Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
|
41
|
-
end
|
42
|
-
|
43
|
-
desired_capabilities = ::Selenium::WebDriver::Remote::Capabilities.__send__(desired_capabilities)
|
44
|
-
end
|
45
|
-
|
46
|
-
bridge = new(opts)
|
47
|
-
capabilities = bridge.create_session(desired_capabilities)
|
48
|
-
|
49
|
-
case bridge.dialect
|
50
|
-
when :oss # for MJSONWP
|
51
|
-
Bridge::MJSONWP.new(capabilities, bridge.session_id, **opts)
|
52
|
-
when :w3c
|
53
|
-
Bridge::W3C.new(capabilities, bridge.session_id, **opts)
|
54
|
-
else
|
55
|
-
raise CoreError, 'cannot understand dialect'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
24
|
# Override
|
60
25
|
# Creates session handling both OSS and W3C dialects.
|
61
|
-
# Copy from Selenium::WebDriver::Remote::Bridge to keep using +merged_capabilities+ for Appium
|
62
26
|
#
|
63
|
-
# @param [::Selenium::WebDriver::Remote::
|
64
|
-
# @return [::Selenium::WebDriver::Remote::Capabilities
|
27
|
+
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash] desired_capabilities A capability
|
28
|
+
# @return [::Selenium::WebDriver::Remote::Capabilities]
|
65
29
|
#
|
66
30
|
# @example
|
67
31
|
#
|
@@ -79,37 +43,27 @@ module Appium
|
|
79
43
|
# }
|
80
44
|
# }
|
81
45
|
# core = ::Appium::Core.for(caps)
|
82
|
-
# driver = core.start_driver
|
46
|
+
# driver = core.start_driver
|
83
47
|
#
|
84
48
|
def create_session(desired_capabilities)
|
85
|
-
|
49
|
+
caps = add_appium_prefix(desired_capabilities)
|
50
|
+
response = execute(:new_session, {}, { capabilities: { firstMatch: [caps] } })
|
86
51
|
|
87
52
|
@session_id = response['sessionId']
|
88
|
-
|
89
|
-
value = response['value']
|
90
|
-
|
91
|
-
if value.is_a?(Hash) # include for W3C format
|
92
|
-
@session_id = value['sessionId'] if value.key?('sessionId')
|
93
|
-
|
94
|
-
if value.key?('capabilities')
|
95
|
-
value = value['capabilities']
|
96
|
-
elsif value.key?('value')
|
97
|
-
value = value['value']
|
98
|
-
end
|
99
|
-
end
|
53
|
+
capabilities = response['capabilities']
|
100
54
|
|
101
55
|
raise ::Selenium::WebDriver::Error::WebDriverError, 'no sessionId in returned payload' unless @session_id
|
102
56
|
|
103
|
-
json_create(
|
57
|
+
@capabilities = json_create(capabilities)
|
104
58
|
end
|
105
59
|
|
106
60
|
# Append +appium:+ prefix for Appium following W3C spec
|
107
61
|
# https://www.w3.org/TR/webdriver/#dfn-validate-capabilities
|
108
62
|
#
|
109
|
-
# @param [::Selenium::WebDriver::Remote::
|
110
|
-
# @return [::Selenium::WebDriver::Remote::
|
63
|
+
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash] capabilities A capability
|
64
|
+
# @return [::Selenium::WebDriver::Remote::Capabilities]
|
111
65
|
def add_appium_prefix(capabilities)
|
112
|
-
w3c_capabilities = ::Selenium::WebDriver::Remote::
|
66
|
+
w3c_capabilities = ::Selenium::WebDriver::Remote::Capabilities.new
|
113
67
|
|
114
68
|
capabilities = capabilities.__send__(:capabilities) unless capabilities.is_a?(Hash)
|
115
69
|
|
@@ -133,56 +87,17 @@ module Appium
|
|
133
87
|
end
|
134
88
|
|
135
89
|
def extension_prefix?(capability_name)
|
136
|
-
snake_cased_capability_names = ::Selenium::WebDriver::Remote::
|
90
|
+
snake_cased_capability_names = ::Selenium::WebDriver::Remote::Capabilities::KNOWN.map(&:to_s)
|
137
91
|
camel_cased_capability_names = snake_cased_capability_names.map { |v| camel_case(v) }
|
138
92
|
|
93
|
+
# Check 'EXTENSION_CAPABILITY_PATTERN'
|
139
94
|
snake_cased_capability_names.include?(capability_name) ||
|
140
95
|
camel_cased_capability_names.include?(capability_name) ||
|
141
|
-
capability_name.match(
|
96
|
+
capability_name.match(':')
|
142
97
|
end
|
143
98
|
|
144
|
-
def json_create(
|
145
|
-
|
146
|
-
::Selenium::WebDriver.logger.info 'Detected OSS dialect.'
|
147
|
-
@dialect = :oss
|
148
|
-
::Selenium::WebDriver::Remote::Capabilities.json_create(value)
|
149
|
-
else
|
150
|
-
::Selenium::WebDriver.logger.info 'Detected W3C dialect.'
|
151
|
-
@dialect = :w3c
|
152
|
-
::Selenium::WebDriver::Remote::W3C::Capabilities.json_create(value)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def delete_force_mjsonwp(capabilities)
|
157
|
-
w3c_capabilities = ::Selenium::WebDriver::Remote::W3C::Capabilities.new
|
158
|
-
|
159
|
-
capabilities = capabilities.__send__(:capabilities) unless capabilities.is_a?(Hash)
|
160
|
-
capabilities.each do |name, value|
|
161
|
-
next if value.nil?
|
162
|
-
next if value.is_a?(String) && value.empty?
|
163
|
-
next if name == FORCE_MJSONWP
|
164
|
-
|
165
|
-
w3c_capabilities[name] = value
|
166
|
-
end
|
167
|
-
|
168
|
-
w3c_capabilities
|
169
|
-
end
|
170
|
-
|
171
|
-
def merged_capabilities(desired_capabilities)
|
172
|
-
force_mjsonwp = desired_capabilities[FORCE_MJSONWP]
|
173
|
-
desired_capabilities = delete_force_mjsonwp(desired_capabilities) unless force_mjsonwp.nil?
|
174
|
-
|
175
|
-
::Appium::Logger.warn "'forceMjsonwp' no longer works. Sending both W3C and MJSONWP capabilities" if force_mjsonwp
|
176
|
-
|
177
|
-
new_caps = add_appium_prefix(desired_capabilities)
|
178
|
-
w3c_capabilities = ::Selenium::WebDriver::Remote::W3C::Capabilities.from_oss(new_caps)
|
179
|
-
|
180
|
-
{
|
181
|
-
desiredCapabilities: desired_capabilities,
|
182
|
-
capabilities: {
|
183
|
-
firstMatch: [w3c_capabilities]
|
184
|
-
}
|
185
|
-
}
|
99
|
+
def json_create(value)
|
100
|
+
::Selenium::WebDriver::Remote::Capabilities.json_create(value)
|
186
101
|
end
|
187
102
|
end # class Bridge
|
188
103
|
end # class Base
|
@@ -16,7 +16,7 @@ module Appium
|
|
16
16
|
module Core
|
17
17
|
class Base
|
18
18
|
class Bridge
|
19
|
-
class W3C < ::Selenium::WebDriver::Remote::
|
19
|
+
class W3C < ::Selenium::WebDriver::Remote::Bridge
|
20
20
|
include Device::DeviceLock
|
21
21
|
include Device::Keyboard
|
22
22
|
include Device::ImeActions
|
@@ -34,6 +34,106 @@ module Appium
|
|
34
34
|
include Device::ExecuteDriver
|
35
35
|
include Device::Orientation
|
36
36
|
|
37
|
+
# TODO: For compatibility. Should remove.
|
38
|
+
def dialect
|
39
|
+
:w3c
|
40
|
+
end
|
41
|
+
|
42
|
+
# TODO: fixme
|
43
|
+
def browser
|
44
|
+
@browser ||= begin
|
45
|
+
name = @capabilities.browser_name
|
46
|
+
name ? name.tr(' ', '_').downcase.to_sym : 'unknown'
|
47
|
+
rescue KeyError
|
48
|
+
'unknown'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Prefix for extra capability defined by W3C
|
53
|
+
APPIUM_PREFIX = 'appium:'
|
54
|
+
|
55
|
+
# Override
|
56
|
+
# Creates session handling both OSS and W3C dialects.
|
57
|
+
#
|
58
|
+
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash] desired_capabilities A capability
|
59
|
+
# @return [::Selenium::WebDriver::Remote::Capabilities]
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
#
|
63
|
+
# opts = {
|
64
|
+
# caps: {
|
65
|
+
# platformName: :ios,
|
66
|
+
# automationName: 'XCUITest',
|
67
|
+
# app: 'test/functional/app/UICatalog.app.zip',
|
68
|
+
# platformVersion: '11.4',
|
69
|
+
# deviceName: 'iPhone Simulator',
|
70
|
+
# useNewWDA: true,
|
71
|
+
# },
|
72
|
+
# appium_lib: {
|
73
|
+
# wait: 30
|
74
|
+
# }
|
75
|
+
# }
|
76
|
+
# core = ::Appium::Core.for(caps)
|
77
|
+
# driver = core.start_driver #=> driver.dialect == :w3c if the Appium server support W3C.
|
78
|
+
#
|
79
|
+
def create_session(desired_capabilities)
|
80
|
+
caps = add_appium_prefix(desired_capabilities)
|
81
|
+
response = execute(:new_session, {}, { capabilities: { firstMatch: [caps] } })
|
82
|
+
|
83
|
+
@session_id = response['sessionId']
|
84
|
+
capabilities = response['capabilities']
|
85
|
+
|
86
|
+
raise ::Selenium::WebDriver::Error::WebDriverError, 'no sessionId in returned payload' unless @session_id
|
87
|
+
|
88
|
+
@capabilities = json_create(capabilities)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Append +appium:+ prefix for Appium following W3C spec
|
92
|
+
# https://www.w3.org/TR/webdriver/#dfn-validate-capabilities
|
93
|
+
#
|
94
|
+
# @param [::Selenium::WebDriver::Remote::Capabilities, Hash] capabilities A capability
|
95
|
+
# @return [::Selenium::WebDriver::Remote::Capabilities]
|
96
|
+
def add_appium_prefix(capabilities)
|
97
|
+
w3c_capabilities = ::Selenium::WebDriver::Remote::Capabilities.new
|
98
|
+
|
99
|
+
capabilities = capabilities.__send__(:capabilities) unless capabilities.is_a?(Hash)
|
100
|
+
|
101
|
+
capabilities.each do |name, value|
|
102
|
+
next if value.nil?
|
103
|
+
next if value.is_a?(String) && value.empty?
|
104
|
+
|
105
|
+
capability_name = name.to_s
|
106
|
+
w3c_name = extension_prefix?(capability_name) ? name : "#{APPIUM_PREFIX}#{capability_name}"
|
107
|
+
|
108
|
+
w3c_capabilities[w3c_name] = value
|
109
|
+
end
|
110
|
+
|
111
|
+
w3c_capabilities
|
112
|
+
end
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
def camel_case(str)
|
117
|
+
str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
|
118
|
+
end
|
119
|
+
|
120
|
+
def extension_prefix?(capability_name)
|
121
|
+
snake_cased_capability_names = ::Selenium::WebDriver::Remote::Capabilities::KNOWN.map(&:to_s)
|
122
|
+
camel_cased_capability_names = snake_cased_capability_names.map { |v| camel_case(v) }
|
123
|
+
|
124
|
+
# Check 'EXTENSION_CAPABILITY_PATTERN'
|
125
|
+
snake_cased_capability_names.include?(capability_name) ||
|
126
|
+
camel_cased_capability_names.include?(capability_name) ||
|
127
|
+
capability_name.match(':')
|
128
|
+
end
|
129
|
+
|
130
|
+
def json_create(value)
|
131
|
+
@dialect = :w3c
|
132
|
+
::Selenium::WebDriver::Remote::Capabilities.json_create(value)
|
133
|
+
end
|
134
|
+
|
135
|
+
public
|
136
|
+
|
37
137
|
def commands(command)
|
38
138
|
::Appium::Core::Commands::W3C::COMMANDS[command]
|
39
139
|
end
|
@@ -43,6 +143,10 @@ module Appium
|
|
43
143
|
execute :get_all_sessions
|
44
144
|
end
|
45
145
|
|
146
|
+
def status
|
147
|
+
execute :status
|
148
|
+
end
|
149
|
+
|
46
150
|
# Perform touch actions for W3C module.
|
47
151
|
# Generate +touch+ pointer action here and users can use this via +driver.action+
|
48
152
|
# - https://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/W3CActionBuilder.html
|
@@ -72,7 +176,7 @@ module Appium
|
|
72
176
|
|
73
177
|
# Port from MJSONWP
|
74
178
|
def session_capabilities
|
75
|
-
::Selenium::WebDriver::Remote::
|
179
|
+
::Selenium::WebDriver::Remote::Capabilities.json_create execute(:get_capabilities)
|
76
180
|
end
|
77
181
|
|
78
182
|
# Port from MJSONWP
|
@@ -166,18 +270,9 @@ module Appium
|
|
166
270
|
|
167
271
|
# For Appium
|
168
272
|
# No implementation for W3C webdriver module
|
169
|
-
|
170
|
-
# It has below code as well. We should consider the same context in Selenium 4 as backward compatibility.
|
171
|
-
#
|
172
|
-
# def location=(loc)
|
173
|
-
# # note: Location = Struct.new(:latitude, :longitude, :altitude)
|
174
|
-
# raise TypeError, "expected #{Location}, got #{loc.inspect}:#{loc.class}" unless loc.is_a?(Location)
|
175
|
-
#
|
176
|
-
# @bridge.set_location loc.latitude, loc.longitude, loc.altitude
|
177
|
-
# end
|
178
|
-
#
|
179
|
-
def set_location(lat, lon, alt = 0.0)
|
273
|
+
def set_location(lat, lon, alt = 0.0, speed: nil)
|
180
274
|
loc = { latitude: lat, longitude: lon, altitude: alt }
|
275
|
+
loc[:speed] = speed unless speed.nil?
|
181
276
|
execute :set_location, {}, { location: loc }
|
182
277
|
end
|
183
278
|
|