init

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers __init__.py Source File

__init__.py

00001 """
00002 mbed SDK
00003 Copyright (c) 2011-2013 ARM Limited
00004 
00005 Licensed under the Apache License, Version 2.0 (the "License");
00006 you may not use this file except in compliance with the License.
00007 You may obtain a copy of the License at
00008 
00009     http://www.apache.org/licenses/LICENSE-2.0
00010 
00011 Unless required by applicable law or agreed to in writing, software
00012 distributed under the License is distributed on an "AS IS" BASIS,
00013 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 See the License for the specific language governing permissions and
00015 limitations under the License.
00016 """
00017 from __future__ import print_function
00018 
00019 from . import host_test_registry
00020 
00021 # This plugins provide 'flashing' methods to host test scripts
00022 from . import module_copy_mbed
00023 from . import module_copy_shell
00024 from . import module_copy_silabs
00025 
00026 try:
00027     from . import module_copy_smart
00028 except:
00029     pass
00030 
00031 #import module_copy_firefox
00032 from . import module_copy_mps2
00033 
00034 # Plugins used to reset certain platform
00035 from . import module_reset_mbed
00036 from . import module_reset_silabs
00037 from . import module_reset_mps2
00038 
00039 
00040 # Plugin registry instance
00041 HOST_TEST_PLUGIN_REGISTRY = host_test_registry.HostTestRegistry()
00042 
00043 # Static plugin registration
00044 # Some plugins are commented out if they are not stable or not commonly used
00045 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mbed.load_plugin())
00046 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_shell.load_plugin())
00047 
00048 try:
00049     HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_smart.load_plugin())
00050 except:
00051     pass
00052 
00053 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mbed.load_plugin())
00054 #HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_firefox.load_plugin())
00055 
00056 # Extra platforms support
00057 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mps2.load_plugin())
00058 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mps2.load_plugin())
00059 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_silabs.load_plugin())
00060 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_silabs.load_plugin())
00061 
00062 # TODO: extend plugin loading to files with name module_*.py loaded ad-hoc
00063 
00064 ###############################################################################
00065 # Functional interface for host test plugin registry
00066 ###############################################################################
00067 def call_plugin(type, capability, *args, **kwargs):
00068     """ Interface to call plugin registry functional way
00069     """
00070     return HOST_TEST_PLUGIN_REGISTRY.call_plugin(type, capability, *args, **kwargs)
00071 
00072 def get_plugin_caps (type):
00073     """ Returns list of all capabilities for plugin family with the same type.
00074         If there are no capabilities empty list is returned
00075     """
00076     return HOST_TEST_PLUGIN_REGISTRY.get_plugin_caps(type)
00077 
00078 def print_plugin_info ():
00079     """ Prints plugins' information in user friendly way
00080     """
00081     print(HOST_TEST_PLUGIN_REGISTRY)