mbed_lstools.lstools_base.MbedLsToolsBase Class Reference
Inheritance diagram for mbed_lstools.lstools_base.MbedLsToolsBase:

## Public Member Functions

def | __init__ (self, list_unmounted=False, kwargs)
def | find_candidates (self)
def | list_mbeds_ext (self)
| Function adds extra information for each mbed device. More...
def | list_mbeds (self, fs_interaction=FSInteraction.BeforeFilter, filter_function=None, unique_names=False, read_details_txt=False)
def | mock_manufacture_id (self, mid, platform_name, oper='+')
| Replace (or add if manufacture id doesn't exist) entry in self.manufacture_ids. More...
def | list_manufacture_ids (self)
| Creates list of all available mappings for target_id -> Platform. More...
def | retarget_read (self)
| Load retarget data from local file. More...
def | retarget (self)
| Enable retargeting. More...
def | get_dummy_platform (self, platform_name)
| Returns simple dummy platform. More...
def | get_supported_platforms (self, device_type=None)
| Return a dictionary of supported target ids and the corresponding platform name. More...
def | list_platforms (self)
| Useful if you just want to know which platforms are currently available on the system. More...
def | list_platforms_ext (self)
| Useful if you just want to know how many platforms of each type are currently available on the system. More...
def | list_mbeds_by_targetid (self)
| Get information about mbeds with extended parameters/info included. More...
def | __str__ (self)
| Object to string casting. More...
def | get_string (self, border=False, header=True, padding_width=1, sortby='platform_name')
| Printing with some sql table like decorators. More...
def | get_json_data_from_file (self, json_spec_filename, verbose=False)
| Loads from file JSON formatted string to data structure. More...
def | get_htm_target_id (self, mount_point)
def | get_mbed_htm (self, mount_point)
def | get_mbed_htm_comment_section_ver_build (self, line)
def | get_mbed_htm_lines (self, mount_point)
def | get_details_txt (self, mount_point)
def | parse_details_txt (self, lines)
def | scan_html_line_for_target_id (self, line)
def | mount_point_ready (self, path)
| Check if a mount point is ready for file operations. More...

## Static Public Member Functions

def | run_cli_process (cmd, shell=True)

## Public Attributes

| retarget_data
| plat_db
| list_unmounted
| dummy_counter

## Static Public Attributes

list | os_supported = []
| HOME_DIR = expanduser("~")
string | MOCK_FILE_NAME = '.mbedls-mock'
string | RETARGET_FILE_NAME = 'mbedls.json'
string | DETAILS_TXT_NAME = 'DETAILS.TXT'
string | MBED_HTM_NAME = 'mbed.htm'
dictionary | VENDOR_ID_DEVICE_TYPE_MAP

## Detailed Description

    Base class for mbed-lstools, defines mbed-ls tools interface for
    mbed-enabled devices detection for various hosts

Definition at line 54 of file lstools_base.py.

## Constructor & Destructor Documentation

## __init__()

def mbed_lstools.lstools_base.MbedLsToolsBase.__init__ | ( |  | self,
|  |  | list_unmounted = `False`,
|  |  | kwargs
| ) |  |

    ctor

Definition at line 79 of file lstools_base.py.

## Member Function Documentation

## __str__()

def mbed_lstools.lstools_base.MbedLsToolsBase.__str__ | ( |  | self | ) |

Object to string casting.

Returns
  Stringified class object should be prettytable formated string

Definition at line 489 of file lstools_base.py.

## find_candidates()

def mbed_lstools.lstools_base.MbedLsToolsBase.find_candidates | ( |  | self | ) |

    Find all candidate devices connected to this computer

    Note: Should not open any files

    @return A dict with the keys 'mount_point', 'serial_port' and 'target_id_usb_id'

Definition at line 98 of file lstools_base.py.

## get_details_txt()

def mbed_lstools.lstools_base.MbedLsToolsBase.get_details_txt | ( |  | self,
|  |  | mount_point
| ) |  |

Definition at line 617 of file lstools_base.py.

## get_dummy_platform()

def mbed_lstools.lstools_base.MbedLsToolsBase.get_dummy_platform | ( |  | self,
|  |  | platform_name
| ) |  |

Returns simple dummy platform.

Definition at line 412 of file lstools_base.py.

## get_htm_target_id()

def mbed_lstools.lstools_base.MbedLsToolsBase.get_htm_target_id | ( |  | self,
|  |  | mount_point
| ) |  |

Definition at line 547 of file lstools_base.py.

## get_json_data_from_file()

def mbed_lstools.lstools_base.MbedLsToolsBase.get_json_data_from_file | ( |  | self,
|  |  | json_spec_filename,
|  |  | verbose = `False`
| ) |  |

Loads from file JSON formatted string to data structure.

Returns
  None if JSON can be loaded

Definition at line 530 of file lstools_base.py.

## get_mbed_htm()

def mbed_lstools.lstools_base.MbedLsToolsBase.get_mbed_htm | ( |  | self,
|  |  | mount_point
| ) |  |

Definition at line 553 of file lstools_base.py.

## get_mbed_htm_comment_section_ver_build()

def mbed_lstools.lstools_base.MbedLsToolsBase.get_mbed_htm_comment_section_ver_build | ( |  | self,
|  |  | line
| ) |  |

Definition at line 578 of file lstools_base.py.

## get_mbed_htm_lines()

def mbed_lstools.lstools_base.MbedLsToolsBase.get_mbed_htm_lines | ( |  | self,
|  |  | mount_point
| ) |  |

Definition at line 606 of file lstools_base.py.

## get_string()

def mbed_lstools.lstools_base.MbedLsToolsBase.get_string | ( |  | self,
|  |  | border = `False`,
|  |  | header = `True`,
|  |  | padding_width = `1`,
|  |  | sortby = `'platform_name'`
| ) |  |

Printing with some sql table like decorators.

Parameters

  border | Table border visibility
  header | Table header visibility
  padding_width | Table padding
  sortby | Column used to sort results

Returns
  Returns string which can be printed on console

Definition at line 498 of file lstools_base.py.

## get_supported_platforms()

def mbed_lstools.lstools_base.MbedLsToolsBase.get_supported_platforms | ( |  | self,
|  |  | device_type = `None`
| ) |  |

Return a dictionary of supported target ids and the corresponding platform name.

Parameters

  device_type | Filter which device entries are returned from the platform database

Returns
  Dictionary of { 'target_id': 'platform_name', ... }

Definition at line 433 of file lstools_base.py.

## list_manufacture_ids()

def mbed_lstools.lstools_base.MbedLsToolsBase.list_manufacture_ids | ( |  | self | ) |

Creates list of all available mappings for target_id -> Platform.

Returns
  String with table formatted output

Definition at line 373 of file lstools_base.py.

## list_mbeds()

def mbed_lstools.lstools_base.MbedLsToolsBase.list_mbeds | ( |  | self,
|  |  | fs_interaction = `FSInteraction.BeforeFilter`,
|  |  | filter_function = `None`,
|  |  | unique_names = `False`,
|  |  | read_details_txt = `False`
| ) |  |

    List details of connected devices
    @return Returns list of structures with detailed info about each mbed
    @param fs_interaction A member of the FSInteraction class that picks the
      trade of between quality of service and speed
    @param filter_function Function that is passed each mbed candidate,
      should return True if it should be included in the result
      Ex. mbeds = list_mbeds(filter_function=lambda m: m['platform_name'] == 'K64F')
    @param unique_names A boolean controlling the presence of the
      'platform_unique_name' member of the output dict
    @param read_details_txt A boolean controlling the presense of the
      output dict attributes read from other files present on the 'mount_point'
    @details Function returns list of dictionaries with mbed attributes 'mount_point', TargetID name etc.
    Function returns mbed list with platform names if possible

Definition at line 121 of file lstools_base.py.

## list_mbeds_by_targetid()

def mbed_lstools.lstools_base.MbedLsToolsBase.list_mbeds_by_targetid | ( |  | self | ) |

Get information about mbeds with extended parameters/info included.

Returns
  Returns dictionary where keys are TargetIDs and values are mbed structures

Ordered by target id (key: target_id).

Definition at line 477 of file lstools_base.py.

## list_mbeds_ext()

def mbed_lstools.lstools_base.MbedLsToolsBase.list_mbeds_ext | ( |  | self | ) |

Function adds extra information for each mbed device.

Returns
  Returns list of mbed devices plus extended data like 'platform_name_unique'

Get information about mbeds with extended parameters/info included

Definition at line 110 of file lstools_base.py.

## list_platforms()

def mbed_lstools.lstools_base.MbedLsToolsBase.list_platforms | ( |  | self | ) |

Useful if you just want to know which platforms are currently available on the system.

Returns
  List of (unique values) available platforms

Definition at line 447 of file lstools_base.py.

## list_platforms_ext()

def mbed_lstools.lstools_base.MbedLsToolsBase.list_platforms_ext | ( |  | self | ) |

Useful if you just want to know how many platforms of each type are currently available on the system.

Returns
  Dict of platform: platform_count

Definition at line 461 of file lstools_base.py.

## mock_manufacture_id()

def mbed_lstools.lstools_base.MbedLsToolsBase.mock_manufacture_id | ( |  | self,
|  |  | mid,
|  |  | platform_name,
|  |  | oper = `'+'`
| ) |  |

Replace (or add if manufacture id doesn't exist) entry in self.manufacture_ids.

Parameters

  oper | '+' add new mock / override existing entry '-' remove mid from mocking entry

Returns
  Mocked structure (json format)

Definition at line 358 of file lstools_base.py.

## mount_point_ready()

def mbed_lstools.lstools_base.MbedLsToolsBase.mount_point_ready | ( |  | self,
|  |  | path
| ) |  |

Check if a mount point is ready for file operations.

Definition at line 689 of file lstools_base.py.

## parse_details_txt()

def mbed_lstools.lstools_base.MbedLsToolsBase.parse_details_txt | ( |  | self,
|  |  | lines
| ) |  |

Definition at line 651 of file lstools_base.py.

## retarget()

def mbed_lstools.lstools_base.MbedLsToolsBase.retarget | ( |  | self | ) |

Enable retargeting.

Read data from local retarget configuration file

Returns
  Retarget data structure read from configuration file

Definition at line 404 of file lstools_base.py.

## retarget_read()

def mbed_lstools.lstools_base.MbedLsToolsBase.retarget_read | ( |  | self | ) |

Load retarget data from local file.

Returns
  Curent retarget configuration (dictionary)

Definition at line 389 of file lstools_base.py.

## run_cli_process()

def mbed_lstools.lstools_base.MbedLsToolsBase.run_cli_process | ( |  | cmd,
|  |  | shell = `True`
| ) |  |

static

Definition at line 697 of file lstools_base.py.

## scan_html_line_for_target_id()

def mbed_lstools.lstools_base.MbedLsToolsBase.scan_html_line_for_target_id | ( |  | self,
|  |  | line
| ) |  |

Definition at line 667 of file lstools_base.py.

## Member Data Documentation

## DETAILS_TXT_NAME

string mbed_lstools.lstools_base.MbedLsToolsBase.DETAILS_TXT_NAME = 'DETAILS.TXT'

static

Definition at line 69 of file lstools_base.py.

## dummy_counter

mbed_lstools.lstools_base.MbedLsToolsBase.dummy_counter

Definition at line 415 of file lstools_base.py.

## HOME_DIR

mbed_lstools.lstools_base.MbedLsToolsBase.HOME_DIR = expanduser("~")

static

Definition at line 66 of file lstools_base.py.

## list_unmounted

mbed_lstools.lstools_base.MbedLsToolsBase.list_unmounted

Definition at line 92 of file lstools_base.py.

## MBED_HTM_NAME

string mbed_lstools.lstools_base.MbedLsToolsBase.MBED_HTM_NAME = 'mbed.htm'

static

Definition at line 70 of file lstools_base.py.

## MOCK_FILE_NAME

string mbed_lstools.lstools_base.MbedLsToolsBase.MOCK_FILE_NAME = '.mbedls-mock'

static

Definition at line 67 of file lstools_base.py.

## os_supported

list mbed_lstools.lstools_base.MbedLsToolsBase.os_supported = []

static

Definition at line 63 of file lstools_base.py.

## plat_db

mbed_lstools.lstools_base.MbedLsToolsBase.plat_db

Definition at line 90 of file lstools_base.py.

## retarget_data

mbed_lstools.lstools_base.MbedLsToolsBase.retarget_data

Definition at line 82 of file lstools_base.py.

## RETARGET_FILE_NAME

string mbed_lstools.lstools_base.MbedLsToolsBase.RETARGET_FILE_NAME = 'mbedls.json'

static

Definition at line 68 of file lstools_base.py.

## VENDOR_ID_DEVICE_TYPE_MAP

dictionary mbed_lstools.lstools_base.MbedLsToolsBase.VENDOR_ID_DEVICE_TYPE_MAP

static

Initial value:
= {
'0483': 'stlink',
'0d28': 'daplink',
'1366': 'jlink',
'03eb': 'atmel'
}

Definition at line 72 of file lstools_base.py.

The documentation for this class was generated from the following file:

- mbed_lstools/lstools_base.py