Skip to content

Commit e1f041f

Browse files
committed
Device Modes
1 parent dfdacdf commit e1f041f

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

lib/appium_lib/device/device.rb

+24-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ module Device
1414
toggle_airplane_mode: 'session/:session_id/appium/device/toggle_airplane_mode',
1515
},
1616
get: {
17-
current_activity: 'session/:session_id/appium/device/current_activity',
18-
current_context: 'session/:session_id/context',
17+
current_activity: 'session/:session_id/appium/device/current_activity',
18+
current_context: 'session/:session_id/context',
19+
get_network_connection: 'session/:session_id/network_connection',
1920
}
2021
}
2122

@@ -263,6 +264,27 @@ def update_settings(settings)
263264
end
264265
end
265266

267+
# @!method get_network_connection
268+
# Get the device network connection current status
269+
# See set_network_connection method for return value
270+
271+
# @!method set_network_connection
272+
# Set the device network connection mode
273+
# @param path (String) Bit mask that represent the network mode
274+
# Value (Alias) | Data | Wifi | Airplane Mode
275+
# -------------------------------------------------
276+
# 1 (Airplane Mode) | 0 | 0 | 1
277+
# 6 (All network on) | 1 | 1 | 0
278+
# 4 (Data only) | 1 | 0 | 0
279+
# 2 (Wifi only) | 0 | 1 | 0
280+
# 0 (None) | 0 | 0 | 0
281+
#
282+
add_endpoint_method(:set_network_connection, 'session/:session_id/network_connection') do
283+
def set_network_connection(mode)
284+
execute :set_network_connection, {}, type: mode
285+
end
286+
end
287+
266288
add_touch_actions
267289
extend_search_contexts
268290
end

0 commit comments

Comments
 (0)