Mbed Host Tests
__init__.py
Go to the documentation of this file.
1 """
2 mbed SDK
3 Copyright (c) 2011-2015 ARM Limited
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 
17 Author: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com>
18 """
19 
20 """! @package mbed-host-test-plugins
21 
22 This package contains plugins used by host test to reset, flash devices etc.
23 This package can be extended with new packages to add more generic functionality
24 
25 """
26 
27 from . import host_test_registry
28 
29 # This plugins provide 'flashing' and 'reset' methods to host test scripts
30 from . import module_copy_shell
31 from . import module_copy_mbed
32 from . import module_reset_mbed
33 from . import module_power_cycle_mbed
34 
35 # Additional, non standard platforms
36 from . import module_copy_silabs
37 from . import module_reset_silabs
38 from . import module_copy_stlink
39 from . import module_reset_stlink
40 from . import module_copy_ublox
41 from . import module_reset_ublox
42 from . import module_reset_mps2
43 from . import module_copy_mps2
44 #import module_copy_jn51xx
45 #import module_reset_jn51xx
46 
47 
48 # Plugin registry instance
49 HOST_TEST_PLUGIN_REGISTRY = host_test_registry.HostTestRegistry()
50 
51 # Static plugin registration
52 # Some plugins are commented out if they are not stable or not commonly used
53 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mbed.load_plugin())
54 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_shell.load_plugin())
55 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mbed.load_plugin())
56 
57 # Extra platforms support
58 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mps2.load_plugin())
59 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mps2.load_plugin())
60 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_silabs.load_plugin())
61 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_silabs.load_plugin())
62 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_stlink.load_plugin())
63 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_stlink.load_plugin())
64 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_power_cycle_mbed.load_plugin())
65 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_ublox.load_plugin())
66 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_ublox.load_plugin())
67 #HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_jn51xx.load_plugin())
68 #HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_jn51xx.load_plugin())
69 
70 # TODO: extend plugin loading to files with name module_*.py loaded ad-hoc
71 
72 
75 def call_plugin(type, capability, *args, **kwargs):
76  """! Interface to call plugin registry functional way
77  @param capability Plugin capability we want to call
78  @param args Additional parameters passed to plugin
79  @param kwargs Additional parameters passed to plugin
80  @return Returns return value from call_plugin call
81  """
82  return HOST_TEST_PLUGIN_REGISTRY.call_plugin(type, capability, *args, **kwargs)
83 
84 def get_plugin_caps(type):
85  """! Get list of all capabilities for plugin family with the same type
86  @param type Type of a plugin
87  @return Returns list of all capabilities for plugin family with the same type. If there are no capabilities empty list is returned
88  """
89  return HOST_TEST_PLUGIN_REGISTRY.get_plugin_caps(type)
90 
92  """! Return plugins information
93  @return Dictionary HOST_TEST_PLUGIN_REGISTRY
94  """
95  return HOST_TEST_PLUGIN_REGISTRY.get_dict()
96 
98  """! Prints plugins' information in user friendly way
99  """
100  print(HOST_TEST_PLUGIN_REGISTRY)
def get_plugin_caps(type)
Get list of all capabilities for plugin family with the same type.
Definition: __init__.py:84
def get_plugin_info()
Return plugins information.
Definition: __init__.py:91
def call_plugin(type, capability, *args, **kwargs)
Functional interface for host test plugin registry.
Definition: __init__.py:75
def print_plugin_info()
Prints plugins' information in user friendly way.
Definition: __init__.py:97