INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
Translates the given address to another address specific to network or service. :param address: (:class:`~hazelcast.core.Address`), private address to be translated :return: (:class:`~hazelcast.core.Address`), new address if given address is known, otherwise returns null
def translate(self, address): """ Translates the given address to another address specific to network or service. :param address: (:class:`~hazelcast.core.Address`), private address to be translated :return: (:class:`~hazelcast.core.Address`), new address if given address is known, othe...
Refreshes the internal lookup table if necessary.
def refresh(self): """ Refreshes the internal lookup table if necessary. """ try: self._private_to_public = self.cloud_discovery.discover_nodes() except Exception as ex: self.logger.warning("Failed to load addresses from Hazelcast.cloud: {}".format(ex.args...
Helper method to get host and url that can be used in HTTPSConnection. :param properties: Client config properties. :param cloud_token: Cloud discovery token. :return: Host and URL pair
def get_host_and_url(properties, cloud_token): """ Helper method to get host and url that can be used in HTTPSConnection. :param properties: Client config properties. :param cloud_token: Cloud discovery token. :return: Host and URL pair """ host = properties.get(...
Calculates the request payload size
def calculate_size(name, message): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_data(message) return data_size
Event handler
def handle(client_message, handle_event_partition_lost=None, to_object=None): """ Event handler """ message_type = client_message.get_message_type() if message_type == EVENT_PARTITIONLOST and handle_event_partition_lost is not None: partition_id = client_message.read_int() lost_backup_count ...
Calculates the request payload size
def calculate_size(name, timeout_millis): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += LONG_SIZE_IN_BYTES return data_size
Calculates the request payload size
def calculate_size(name, txn_id, thread_id, key, old_value, new_value): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_str(txn_id) data_size += LONG_SIZE_IN_BYTES data_size += calculate_size_data(key) data_size += ca...
Calculates the request payload size
def calculate_size(name, thread_id): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += LONG_SIZE_IN_BYTES return data_size
Calculates the request payload size
def calculate_size(uuid, address, interrupt): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(uuid) data_size += calculate_size_address(address) data_size += BOOLEAN_SIZE_IN_BYTES return data_size
Encode request into client_message
def encode_request(uuid, address, interrupt): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(uuid, address, interrupt)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(uuid) Addr...
Sets the count to the given value if the current count is zero. If count is not zero, this method does nothing and returns ``false``. :param count: (int), the number of times count_down() must be invoked before threads can pass through await(). :return: (bool), ``true`` if the new count was set...
def try_set_count(self, count): """ Sets the count to the given value if the current count is zero. If count is not zero, this method does nothing and returns ``false``. :param count: (int), the number of times count_down() must be invoked before threads can pass through await(). ...
Destroys this proxy. :return: (bool), ``true`` if this proxy is deleted successfully, ``false`` otherwise.
def destroy(self): """ Destroys this proxy. :return: (bool), ``true`` if this proxy is deleted successfully, ``false`` otherwise. """ self._on_destroy() return self._client.proxy.destroy_proxy(self.service_name, self.name)
Calculates the request payload size
def calculate_size(name, delta): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += LONG_SIZE_IN_BYTES return data_size
Adds a membership listener to listen for membership updates, it will be notified when a member is added to cluster or removed from cluster. There is no check for duplicate registrations, so if you register the listener twice, it will get events twice. :param member_added: (Function), function ...
def add_listener(self, member_added=None, member_removed=None, fire_for_existing=False): """ Adds a membership listener to listen for membership updates, it will be notified when a member is added to cluster or removed from cluster. There is no check for duplicate registrations, so if you regist...
Removes the specified membership listener. :param registration_id: (str), registration id of the listener to be deleted. :return: (bool), if the registration is removed, ``false`` otherwise.
def remove_listener(self, registration_id): """ Removes the specified membership listener. :param registration_id: (str), registration id of the listener to be deleted. :return: (bool), if the registration is removed, ``false`` otherwise. """ try: self.listen...
Returns the member with specified member uuid. :param member_uuid: (int), uuid of the desired member. :return: (:class:`~hazelcast.core.Member`), the corresponding member.
def get_member_by_uuid(self, member_uuid): """ Returns the member with specified member uuid. :param member_uuid: (int), uuid of the desired member. :return: (:class:`~hazelcast.core.Member`), the corresponding member. """ for member in self.get_member_list(): ...
Returns the members that satisfy the given selector. :param selector: (:class:`~hazelcast.core.MemberSelector`), Selector to be applied to the members. :return: (List), List of members.
def get_members(self, selector): """ Returns the members that satisfy the given selector. :param selector: (:class:`~hazelcast.core.MemberSelector`), Selector to be applied to the members. :return: (List), List of members. """ members = [] for member in self.get_...
Returns true if this vector clock is causally strictly after the provided vector clock. This means that it the provided clock is neither equal to, greater than or concurrent to this vector clock. :param other: (:class:`~hazelcast.cluster.VectorClock`), Vector clock to be compared :retur...
def is_after(self, other): """ Returns true if this vector clock is causally strictly after the provided vector clock. This means that it the provided clock is neither equal to, greater than or concurrent to this vector clock. :param other: (:class:`~hazelcast.cluster.VectorCloc...
Determines whether this set contains the specified item or not. :param item: (object), the specified item to be searched. :return: (bool), ``true`` if the specified item exists in this set, ``false`` otherwise.
def contains(self, item): """ Determines whether this set contains the specified item or not. :param item: (object), the specified item to be searched. :return: (bool), ``true`` if the specified item exists in this set, ``false`` otherwise. """ check_not_none(item, "Valu...
Determines whether this set contains all of the items in the specified collection or not. :param items: (Collection), the specified collection which includes the items to be searched. :return: (bool), ``true`` if all of the items in the specified collection exist in this set, ``false`` otherwise.
def contains_all(self, items): """ Determines whether this set contains all of the items in the specified collection or not. :param items: (Collection), the specified collection which includes the items to be searched. :return: (bool), ``true`` if all of the items in the specified colle...
Removes the specified item listener. Returns silently if the specified listener was not added before. :param registration_id: (str), id of the listener to be deleted. :return: (bool), ``true`` if the item listener is removed, ``false`` otherwise.
def remove_listener(self, registration_id): """ Removes the specified item listener. Returns silently if the specified listener was not added before. :param registration_id: (str), id of the listener to be deleted. :return: (bool), ``true`` if the item listener is removed, ``false`` oth...
Calculates the request payload size
def calculate_size(name, expected, updated): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += LONG_SIZE_IN_BYTES data_size += LONG_SIZE_IN_BYTES return data_size
Encode request into client_message
def encode_request(name, expected, updated): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(name, expected, updated)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(name) client...
Calculates the request payload size
def calculate_size(name, interceptor): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_data(interceptor) return data_size
Calculates the request payload size
def calculate_size(name, uuid, callable, partition_id): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_str(uuid) data_size += calculate_size_data(callable) data_size += INT_SIZE_IN_BYTES return data_size
Encode request into client_message
def encode_request(name, uuid, callable, partition_id): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(name, uuid, callable, partition_id)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.appen...
Alters the currently stored value by applying a function on it. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side with the actual ...
def alter(self, function): """ Alters the currently stored value by applying a function on it. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part reg...
Alters the currently stored value by applying a function on it and gets the result. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side with...
def alter_and_get(self, function): """ Alters the currently stored value by applying a function on it and gets the result. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializab...
Applies a function on the value, the actual stored value will not change. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side with the actua...
def apply(self, function): """ Applies a function on the value, the actual stored value will not change. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counte...
Atomically sets the value to the given updated value only if the current value == the expected value. :param expected: (long), the expected value. :param updated: (long), the new value. :return: (bool), ``true`` if successful; or ``false`` if the actual value was not equal to the expected value...
def compare_and_set(self, expected, updated): """ Atomically sets the value to the given updated value only if the current value == the expected value. :param expected: (long), the expected value. :param updated: (long), the new value. :return: (bool), ``true`` if successful; or...
Alters the currently stored value by applying a function on it on and gets the old value. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server sid...
def get_and_alter(self, function): """ Alters the currently stored value by applying a function on it on and gets the old value. :param function: (Function), A stateful serializable object which represents the Function defined on server side. This object must have a seri...
Calculates the request payload size
def calculate_size(name, key): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_data(key) return data_size
Prints the core's information. Args: jlink_serial (str): the J-Link serial number device (str): the target CPU Returns: Always returns ``0``. Raises: JLinkException: on error
def main(jlink_serial, device): """Prints the core's information. Args: jlink_serial (str): the J-Link serial number device (str): the target CPU Returns: Always returns ``0``. Raises: JLinkException: on error """ buf = StringIO.StringIO() jlink = pylink.JLink(log=...
Attempts to acquire a lock for the J-Link lockfile. If the lockfile exists but does not correspond to an active process, the lockfile is first removed, before an attempt is made to acquire it. Args: self (Jlock): the ``JLock`` instance Returns: ``True`` if the lock...
def acquire(self): """Attempts to acquire a lock for the J-Link lockfile. If the lockfile exists but does not correspond to an active process, the lockfile is first removed, before an attempt is made to acquire it. Args: self (Jlock): the ``JLock`` instance Returns: ...
Cleans up the lockfile if it was acquired. Args: self (JLock): the ``JLock`` instance Returns: ``False`` if the lock was not released or the lock is not acquired, otherwise ``True``.
def release(self): """Cleans up the lockfile if it was acquired. Args: self (JLock): the ``JLock`` instance Returns: ``False`` if the lock was not released or the lock is not acquired, otherwise ``True``. """ if not self.acquired: retur...
Starts the SWD transaction. Steps for a Write Transaction: 1. First phase in which the request is sent. 2. Second phase in which an ACK is received. This phase consists of three bits. An OK response has the value ``1``. 3. Everytime the SWD IO may change directio...
def send(self, jlink): """Starts the SWD transaction. Steps for a Write Transaction: 1. First phase in which the request is sent. 2. Second phase in which an ACK is received. This phase consists of three bits. An OK response has the value ``1``. 3. Everyt...
Starts the SWD transaction. Steps for a Read Transaction: 1. First phase in which the request is sent. 2. Second phase in which an ACK is received. This phase consists of three bits. An OK response has the value ``1``. 3. Once the ACK is received, the data phase ...
def send(self, jlink): """Starts the SWD transaction. Steps for a Read Transaction: 1. First phase in which the request is sent. 2. Second phase in which an ACK is received. This phase consists of three bits. An OK response has the value ``1``. 3. Once th...
Creates a console progress bar. This should be called in a loop to create a progress bar. See `StackOverflow <http://stackoverflow.com/questions/3173320/>`__. Args: iteration (int): current iteration total (int): total iterations prefix (str): prefix string suffix (str): suffix st...
def progress_bar(iteration, total, prefix=None, suffix=None, decs=1, length=100): """Creates a console progress bar. This should be called in a loop to create a progress bar. See `StackOverflow <http://stackoverflow.com/q...
Callback that can be used with ``JLink.flash()``. This callback generates a progress bar in the console to show the progress of each of the steps of the flash. Args: action (str): the current action being invoked progress_string (str): the current step in the progress percentage (int): t...
def flash_progress_callback(action, progress_string, percentage): """Callback that can be used with ``JLink.flash()``. This callback generates a progress bar in the console to show the progress of each of the steps of the flash. Args: action (str): the current action being invoked progress...
Calculates and returns the parity of a number. The parity of a number is ``1`` if the number has an odd number of ones in its binary representation, otherwise ``0``. Args: n (int): the number whose parity to calculate Returns: ``1`` if the number has an odd number of ones, otherwise ``0``...
def calculate_parity(n): """Calculates and returns the parity of a number. The parity of a number is ``1`` if the number has an odd number of ones in its binary representation, otherwise ``0``. Args: n (int): the number whose parity to calculate Returns: ``1`` if the number has an odd...
Implements a Serial Wire Viewer (SWV). A Serial Wire Viewer (SWV) allows us implement real-time logging of output from a connected device over Serial Wire Output (SWO). Args: jlink_serial (str): the J-Link serial number device (str): the target CPU Returns: Always returns ``0``. ...
def serial_wire_viewer(jlink_serial, device): """Implements a Serial Wire Viewer (SWV). A Serial Wire Viewer (SWV) allows us implement real-time logging of output from a connected device over Serial Wire Output (SWO). Args: jlink_serial (str): the J-Link serial number device (str): the tar...
Packs a given value into an array of 8-bit unsigned integers. If ``nbits`` is not present, calculates the minimal number of bits required to represent the given ``value``. The result is little endian. Args: value (int): the integer value to pack nbits (int): optional number of bits to use to ...
def pack(value, nbits=None): """Packs a given value into an array of 8-bit unsigned integers. If ``nbits`` is not present, calculates the minimal number of bits required to represent the given ``value``. The result is little endian. Args: value (int): the integer value to pack nbits (int)...
Reads and returns the contents of the README. On failure, returns the project long description. Returns: The project's long description.
def long_description(): """Reads and returns the contents of the README. On failure, returns the project long description. Returns: The project's long description. """ cwd = os.path.abspath(os.path.dirname(__file__)) readme_path = os.path.join(cwd, 'README.md') if not os.path.exists(...
Populate the attributes. Args: self (CleanCommand): the ``CleanCommand`` instance Returns: ``None``
def finalize_options(self): """Populate the attributes. Args: self (CleanCommand): the ``CleanCommand`` instance Returns: ``None`` """ self.cwd = os.path.abspath(os.path.dirname(__file__)) self.build_dirs = [ os.path.join(self.cwd, 'build...
Runs the command. Args: self (CleanCommand): the ``CleanCommand`` instance Returns: ``None``
def run(self): """Runs the command. Args: self (CleanCommand): the ``CleanCommand`` instance Returns: ``None`` """ for build_dir in self.build_dirs: if os.path.isdir(build_dir): sys.stdout.write('Removing %s%s' % (build_dir, os.li...
Finalizes the command's options. Args: self (CoverageCommand): the ``CoverageCommand`` instance Returns: ``None``
def finalize_options(self): """Finalizes the command's options. Args: self (CoverageCommand): the ``CoverageCommand`` instance Returns: ``None`` """ self.cwd = os.path.abspath(os.path.dirname(__file__)) self.test_dir = os.path.join(self.cwd, 'tests')
Returns the string message for the given ``error_code``. Args: cls (JlinkGlobalErrors): the ``JLinkGlobalErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises: ValueError: if the error co...
def to_string(cls, error_code): """Returns the string message for the given ``error_code``. Args: cls (JlinkGlobalErrors): the ``JLinkGlobalErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Ra...
Returns the string message for the given ``error_code``. Args: cls (JLinkEraseErrors): the ``JLinkEraseErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises: ValueError: if the error code...
def to_string(cls, error_code): """Returns the string message for the given ``error_code``. Args: cls (JLinkEraseErrors): the ``JLinkEraseErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Rais...
Returns the string message for the given ``error_code``. Args: cls (JLinkFlashErrors): the ``JLinkFlashErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises: ValueError: if the error code...
def to_string(cls, error_code): """Returns the string message for the given ``error_code``. Args: cls (JLinkFlashErrors): the ``JLinkFlashErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Rais...
Returns the string message for the given ``error_code``. Args: cls (JLinkWriteErrors): the ``JLinkWriteErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises: ValueError: if the error code...
def to_string(cls, error_code): """Returns the string message for the given ``error_code``. Args: cls (JLinkWriteErrors): the ``JLinkWriteErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Rais...
Returns the string message for the given ``error_code``. Args: cls (JLinkReadErrors): the ``JLinkReadErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises: ValueError: if the error code i...
def to_string(cls, error_code): """Returns the string message for the given ``error_code``. Args: cls (JLinkReadErrors): the ``JLinkReadErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises...
Returns the string message for the given error code. Args: cls (JLinkDataErrors): the ``JLinkDataErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises: ValueError: if the error code is in...
def to_string(cls, error_code): """Returns the string message for the given error code. Args: cls (JLinkDataErrors): the ``JLinkDataErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises: ...
Returns the string message for the given error code. Args: cls (JLinkRTTErrors): the ``JLinkRTTErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises: ValueError: if the error code is inva...
def to_string(cls, error_code): """Returns the string message for the given error code. Args: cls (JLinkRTTErrors): the ``JLinkRTTErrors`` class error_code (int): error code to convert Returns: An error string corresponding to the error code. Raises: ...
Checks whether the given flags are a valid identity. Args: identity (Identity): the identity to validate against flags (register.IDCodeRegisterFlags): the set idcode flags Returns: ``True`` if the given ``flags`` correctly identify the the debug interface, otherwise ``False``.
def unlock_kinetis_identified(identity, flags): """Checks whether the given flags are a valid identity. Args: identity (Identity): the identity to validate against flags (register.IDCodeRegisterFlags): the set idcode flags Returns: ``True`` if the given ``flags`` correctly identify the t...
Returns the abort register clear code. Returns: The abort register clear code.
def unlock_kinetis_abort_clear(): """Returns the abort register clear code. Returns: The abort register clear code. """ flags = registers.AbortRegisterFlags() flags.STKCMPCLR = 1 flags.STKERRCLR = 1 flags.WDERRCLR = 1 flags.ORUNERRCLR = 1 return flags.value
Polls the device until the request is acknowledged. Sends a read request to the connected device to read the register at the given 'address'. Polls indefinitely until either the request is ACK'd or the request ends in a fault. Args: jlink (JLink): the connected J-Link address (int) the ad...
def unlock_kinetis_read_until_ack(jlink, address): """Polls the device until the request is acknowledged. Sends a read request to the connected device to read the register at the given 'address'. Polls indefinitely until either the request is ACK'd or the request ends in a fault. Args: jlin...
Unlocks a Kinetis device over SWD. Steps Involved in Unlocking: 1. Verify that the device is configured to read/write from the CoreSight registers; this is done by reading the Identification Code Register and checking its validity. This register is always at 0x0 on reads. 2. Chec...
def unlock_kinetis_swd(jlink): """Unlocks a Kinetis device over SWD. Steps Involved in Unlocking: 1. Verify that the device is configured to read/write from the CoreSight registers; this is done by reading the Identification Code Register and checking its validity. This register is ...
Unlock for Freescale Kinetis K40 or K60 device. Args: jlink (JLink): an instance of a J-Link that is connected to a target. Returns: ``True`` if the device was successfully unlocked, otherwise ``False``. Raises: ValueError: if the J-Link is not connected to a target.
def unlock_kinetis(jlink): """Unlock for Freescale Kinetis K40 or K60 device. Args: jlink (JLink): an instance of a J-Link that is connected to a target. Returns: ``True`` if the device was successfully unlocked, otherwise ``False``. Raises: ValueError: if the J-Link is not connecte...
Implements a Serial Wire Viewer (SWV). A Serial Wire Viewer (SWV) allows us implement real-time logging of output from a connected device over Serial Wire Output (SWO). Args: jlink_serial (str): the J-Link serial number device (str): the target CPU Returns: Always returns ``0``. ...
def serial_wire_viewer(jlink_serial, device): """Implements a Serial Wire Viewer (SWV). A Serial Wire Viewer (SWV) allows us implement real-time logging of output from a connected device over Serial Wire Output (SWO). Args: jlink_serial (str): the J-Link serial number device (str): the tar...
Decorator to specify the minimum SDK version required. Args: version (str): valid version string Returns: A decorator function.
def minimum_required(version): """Decorator to specify the minimum SDK version required. Args: version (str): valid version string Returns: A decorator function. """ def _minimum_required(func): """Internal decorator that wraps around the given f...
Decorator to specify that the J-Link DLL must be opened, and a J-Link connection must be established. Args: func (function): function being decorated Returns: The wrapper function.
def open_required(func): """Decorator to specify that the J-Link DLL must be opened, and a J-Link connection must be established. Args: func (function): function being decorated Returns: The wrapper function. """ @functools.wraps(func) def wr...
Decorator to specify that a target connection is required in order for the given method to be used. Args: func (function): function being decorated Returns: The wrapper function.
def connection_required(func): """Decorator to specify that a target connection is required in order for the given method to be used. Args: func (function): function being decorated Returns: The wrapper function. """ @functools.wraps(func) de...
Decorator to specify that a particular interface type is required for the given method to be used. Args: interface (int): attribute of ``JLinkInterfaces`` Returns: A decorator function.
def interface_required(interface): """Decorator to specify that a particular interface type is required for the given method to be used. Args: interface (int): attribute of ``JLinkInterfaces`` Returns: A decorator function. """ def _interface_require...
Setter for the log handler function. Args: self (JLink): the ``JLink`` instance Returns: ``None``
def log_handler(self, handler): """Setter for the log handler function. Args: self (JLink): the ``JLink`` instance Returns: ``None`` """ if not self.opened(): handler = handler or util.noop self._log_handler = enums.JLinkFunctions.LOG...
Setter for the detailed log handler function. Args: self (JLink): the ``JLink`` instance Returns: ``None``
def detailed_log_handler(self, handler): """Setter for the detailed log handler function. Args: self (JLink): the ``JLink`` instance Returns: ``None`` """ if not self.opened(): handler = handler or util.noop self._detailed_log_handler...
Setter for the error handler function. If the DLL is open, this function is a no-op, so it should be called prior to calling ``open()``. Args: self (JLink): the ``JLink`` instance handler (function): function to call on error messages Returns: ``None``
def error_handler(self, handler): """Setter for the error handler function. If the DLL is open, this function is a no-op, so it should be called prior to calling ``open()``. Args: self (JLink): the ``JLink`` instance handler (function): function to call on error mes...
Setter for the warning handler function. If the DLL is open, this function is a no-op, so it should be called prior to calling ``open()``. Args: self (JLink): the ``JLink`` instance handler (function): function to call on warning messages Returns: ``None`...
def warning_handler(self, handler): """Setter for the warning handler function. If the DLL is open, this function is a no-op, so it should be called prior to calling ``open()``. Args: self (JLink): the ``JLink`` instance handler (function): function to call on warni...
Returns a list of all the connected emulators. Args: self (JLink): the ``JLink`` instance host (int): host type to search (default: ``JLinkHost.USB``) Returns: List of ``JLinkConnectInfo`` specifying the connected emulators. Raises: JLinkException: if f...
def connected_emulators(self, host=enums.JLinkHost.USB): """Returns a list of all the connected emulators. Args: self (JLink): the ``JLink`` instance host (int): host type to search (default: ``JLinkHost.USB``) Returns: List of ``JLinkConnectInfo`` specifying the ...
Gets the device at the given ``index``. Args: self (JLink): the ``JLink`` instance index (int): the index of the device whose information to get Returns: A ``JLinkDeviceInfo`` describing the requested device. Raises: ValueError: if index is less than 0 ...
def supported_device(self, index=0): """Gets the device at the given ``index``. Args: self (JLink): the ``JLink`` instance index (int): the index of the device whose information to get Returns: A ``JLinkDeviceInfo`` describing the requested device. Raises...
Connects to the J-Link emulator (defaults to USB). If ``serial_no`` and ``ip_addr`` are both given, this function will connect to the J-Link over TCP/IP. Args: self (JLink): the ``JLink`` instance serial_no (int): serial number of the J-Link ip_addr (str): IP addr...
def open(self, serial_no=None, ip_addr=None): """Connects to the J-Link emulator (defaults to USB). If ``serial_no`` and ``ip_addr`` are both given, this function will connect to the J-Link over TCP/IP. Args: self (JLink): the ``JLink`` instance serial_no (int): ser...
Connects to the J-Link emulator (over SEGGER tunnel). Args: self (JLink): the ``JLink`` instance serial_no (int): serial number of the J-Link port (int): optional port number (default to 19020). Returns: ``None``
def open_tunnel(self, serial_no, port=19020): """Connects to the J-Link emulator (over SEGGER tunnel). Args: self (JLink): the ``JLink`` instance serial_no (int): serial number of the J-Link port (int): optional port number (default to 19020). Returns: `...
Closes the open J-Link. Args: self (JLink): the ``JLink`` instance Returns: ``None`` Raises: JLinkException: if there is no connected JLink.
def close(self): """Closes the open J-Link. Args: self (JLink): the ``JLink`` instance Returns: ``None`` Raises: JLinkException: if there is no connected JLink. """ self._dll.JLINKARM_Close() if self._lock is not None: ...
Syncs the emulator's firmware version and the DLL's firmware. This method is useful for ensuring that the firmware running on the J-Link matches the firmware supported by the DLL. Args: self (JLink): the ``JLink`` instance Returns: ``None``
def sync_firmware(self): """Syncs the emulator's firmware version and the DLL's firmware. This method is useful for ensuring that the firmware running on the J-Link matches the firmware supported by the DLL. Args: self (JLink): the ``JLink`` instance Returns: ...
Executes the given command. This method executes a command by calling the DLL's exec method. Direct API methods should be prioritized over calling this method. Args: self (JLink): the ``JLink`` instance cmd (str): the command to run Returns: The return co...
def exec_command(self, cmd): """Executes the given command. This method executes a command by calling the DLL's exec method. Direct API methods should be prioritized over calling this method. Args: self (JLink): the ``JLink`` instance cmd (str): the command to run ...
Configures the JTAG scan chain to determine which CPU to address. Must be called if the J-Link is connected to a JTAG scan chain with multiple devices. Args: self (JLink): the ``JLink`` instance instr_regs (int): length of instruction registers of all devices cl...
def jtag_configure(self, instr_regs=0, data_bits=0): """Configures the JTAG scan chain to determine which CPU to address. Must be called if the J-Link is connected to a JTAG scan chain with multiple devices. Args: self (JLink): the ``JLink`` instance instr_regs (int...
Prepares target and J-Link for CoreSight function usage. Args: self (JLink): the ``JLink`` instance ir_pre (int): sum of instruction register length of all JTAG devices in the JTAG chain, close to TDO than the actual one, that J-Link shall communicate with ...
def coresight_configure(self, ir_pre=0, dr_pre=0, ir_post=0, dr_post=0, ir_len=0, perform_tif_init=True): """Prepares target and J-Link for Core...
Connects the J-Link to its target. Args: self (JLink): the ``JLink`` instance chip_name (str): target chip name speed (int): connection speed, one of ``{5-12000, 'auto', 'adaptive'}`` verbose (bool): boolean indicating if connection should be verbose in logging ...
def connect(self, chip_name, speed='auto', verbose=False): """Connects the J-Link to its target. Args: self (JLink): the ``JLink`` instance chip_name (str): target chip name speed (int): connection speed, one of ``{5-12000, 'auto', 'adaptive'}`` verbose (bool): b...
Returns the device's version. The device's version is returned as a string of the format: M.mr where ``M`` is major number, ``m`` is minor number, and ``r`` is revision character. Args: self (JLink): the ``JLink`` instance Returns: Device version string.
def version(self): """Returns the device's version. The device's version is returned as a string of the format: M.mr where ``M`` is major number, ``m`` is minor number, and ``r`` is revision character. Args: self (JLink): the ``JLink`` instance Returns: ...
Returns a string specifying the date and time at which the DLL was translated. Args: self (JLink): the ``JLink`` instance Returns: Datetime string.
def compile_date(self): """Returns a string specifying the date and time at which the DLL was translated. Args: self (JLink): the ``JLink`` instance Returns: Datetime string. """ result = self._dll.JLINKARM_GetCompileDateTime() return ctypes....
Returns the DLL's compatible J-Link firmware version. Args: self (JLink): the ``JLink`` instance Returns: The firmware version of the J-Link that the DLL is compatible with. Raises: JLinkException: on error.
def compatible_firmware_version(self): """Returns the DLL's compatible J-Link firmware version. Args: self (JLink): the ``JLink`` instance Returns: The firmware version of the J-Link that the DLL is compatible with. Raises: JLinkException: on er...
Returns whether the J-Link's firmware version is older than the one that the DLL is compatible with. Note: This is not the same as calling ``not jlink.firmware_newer()``. Args: self (JLink): the ``JLink`` instance Returns: ``True`` if the J-Link's firmwar...
def firmware_outdated(self): """Returns whether the J-Link's firmware version is older than the one that the DLL is compatible with. Note: This is not the same as calling ``not jlink.firmware_newer()``. Args: self (JLink): the ``JLink`` instance Returns: ...
Returns a list of 32 integer values corresponding to the bitfields specifying the power consumption of the target. The values returned by this function only have significance if the J-Link is powering the target. The words, indexed, have the following significance: 0. If ``1`...
def hardware_info(self, mask=0xFFFFFFFF): """Returns a list of 32 integer values corresponding to the bitfields specifying the power consumption of the target. The values returned by this function only have significance if the J-Link is powering the target. The words, indexed, ...
Retrieves and returns the hardware status. Args: self (JLink): the ``JLink`` instance Returns: A ``JLinkHardwareStatus`` describing the J-Link hardware.
def hardware_status(self): """Retrieves and returns the hardware status. Args: self (JLink): the ``JLink`` instance Returns: A ``JLinkHardwareStatus`` describing the J-Link hardware. """ stat = structs.JLinkHardwareStatus() res = self._dll.JLINKARM_G...
Returns the hardware version of the connected J-Link as a major.minor string. Args: self (JLink): the ``JLink`` instance Returns: Hardware version string.
def hardware_version(self): """Returns the hardware version of the connected J-Link as a major.minor string. Args: self (JLink): the ``JLink`` instance Returns: Hardware version string. """ version = self._dll.JLINKARM_GetHardwareVersion() ma...
Returns a firmware identification string of the connected J-Link. It consists of the following: - Product Name (e.g. J-Link) - The string: compiled - Compile data and time. - Optional additional information. Args: self (JLink): the ``JLink`` instance ...
def firmware_version(self): """Returns a firmware identification string of the connected J-Link. It consists of the following: - Product Name (e.g. J-Link) - The string: compiled - Compile data and time. - Optional additional information. Args: ...
Gets the capabilities of the connected emulator as a list. Args: self (JLink): the ``JLink`` instance Returns: List of 32 integers which define the extended capabilities based on their value and index within the list.
def extended_capabilities(self): """Gets the capabilities of the connected emulator as a list. Args: self (JLink): the ``JLink`` instance Returns: List of 32 integers which define the extended capabilities based on their value and index within the list. ""...
Returns a list of the J-Link embedded features. Args: self (JLink): the ``JLink`` instance Returns: A list of strings, each a feature. Example: ``[ 'RDI', 'FlashBP', 'FlashDL', 'JFlash', 'GDB' ]``
def features(self): """Returns a list of the J-Link embedded features. Args: self (JLink): the ``JLink`` instance Returns: A list of strings, each a feature. Example: ``[ 'RDI', 'FlashBP', 'FlashDL', 'JFlash', 'GDB' ]`` """ buf = (ctypes.c_char * ...
Returns the product name of the connected J-Link. Args: self (JLink): the ``JLink`` instance Returns: Product name.
def product_name(self): """Returns the product name of the connected J-Link. Args: self (JLink): the ``JLink`` instance Returns: Product name. """ buf = (ctypes.c_char * self.MAX_BUF_SIZE)() self._dll.JLINKARM_EMU_GetProductName(buf, self.MAX_BUF_SIZ...
Retrieves and returns the OEM string of the connected J-Link. Args: self (JLink): the ``JLink`` instance Returns: The string of the OEM. If this is an original SEGGER product, then ``None`` is returned instead. Raises: JLinkException: on hardware error...
def oem(self): """Retrieves and returns the OEM string of the connected J-Link. Args: self (JLink): the ``JLink`` instance Returns: The string of the OEM. If this is an original SEGGER product, then ``None`` is returned instead. Raises: JLinkEx...
Sets the speed of the JTAG communication with the ARM core. If no arguments are present, automatically detects speed. If a ``speed`` is provided, the speed must be no larger than ``JLink.MAX_JTAG_SPEED`` and no smaller than ``JLink.MIN_JTAG_SPEED``. The given ``speed`` can also not be ...
def set_speed(self, speed=None, auto=False, adaptive=False): """Sets the speed of the JTAG communication with the ARM core. If no arguments are present, automatically detects speed. If a ``speed`` is provided, the speed must be no larger than ``JLink.MAX_JTAG_SPEED`` and no smaller tha...
Retrieves information about supported target interface speeds. Args: self (JLink): the ``JLink`` instance Returns: The ``JLinkSpeedInfo`` instance describing the supported target interface speeds.
def speed_info(self): """Retrieves information about supported target interface speeds. Args: self (JLink): the ``JLink`` instance Returns: The ``JLinkSpeedInfo`` instance describing the supported target interface speeds. """ speed_info = structs.J...
Returns a string of the built-in licenses the J-Link has. Args: self (JLink): the ``JLink`` instance Returns: String of the contents of the built-in licenses the J-Link has.
def licenses(self): """Returns a string of the built-in licenses the J-Link has. Args: self (JLink): the ``JLink`` instance Returns: String of the contents of the built-in licenses the J-Link has. """ buf_size = self.MAX_BUF_SIZE buf = (ctypes.c_char...
Returns a string of the installed licenses the J-Link has. Args: self (JLink): the ``JLink`` instance Returns: String of the contents of the custom licenses the J-Link has.
def custom_licenses(self): """Returns a string of the installed licenses the J-Link has. Args: self (JLink): the ``JLink`` instance Returns: String of the contents of the custom licenses the J-Link has. """ buf = (ctypes.c_char * self.MAX_BUF_SIZE)() ...
Adds the given ``contents`` as a new custom license to the J-Link. Args: self (JLink): the ``JLink`` instance contents: the string contents of the new custom license Returns: ``True`` if license was added, ``False`` if license already existed. Raises: J...
def add_license(self, contents): """Adds the given ``contents`` as a new custom license to the J-Link. Args: self (JLink): the ``JLink`` instance contents: the string contents of the new custom license Returns: ``True`` if license was added, ``False`` if license a...
Returns a bitmask of the supported target interfaces. Args: self (JLink): the ``JLink`` instance Returns: Bitfield specifying which target interfaces are supported.
def supported_tifs(self): """Returns a bitmask of the supported target interfaces. Args: self (JLink): the ``JLink`` instance Returns: Bitfield specifying which target interfaces are supported. """ buf = ctypes.c_uint32() self._dll.JLINKARM_TIF_GetAv...
Selects the specified target interface. Note that a restart must be triggered for this to take effect. Args: self (Jlink): the ``JLink`` instance interface (int): integer identifier of the interface Returns: ``True`` if target was updated, otherwise ``False``. ...
def set_tif(self, interface): """Selects the specified target interface. Note that a restart must be triggered for this to take effect. Args: self (Jlink): the ``JLink`` instance interface (int): integer identifier of the interface Returns: ``True`` if ta...
Returns the properties of the user-controllable GPIOs. Provided the device supports user-controllable GPIOs, they will be returned by this method. Args: self (JLink): the ``JLink`` instance Returns: A list of ``JLinkGPIODescriptor`` instances totalling the number o...
def gpio_properties(self): """Returns the properties of the user-controllable GPIOs. Provided the device supports user-controllable GPIOs, they will be returned by this method. Args: self (JLink): the ``JLink`` instance Returns: A list of ``JLinkGPIODescrip...
Returns a list of states for the given pins. Defaults to the first four pins if an argument is not given. Args: self (JLink): the ``JLink`` instance pins (list): indices of the GPIO pins whose states are requested Returns: A list of states. Raises: ...
def gpio_get(self, pins=None): """Returns a list of states for the given pins. Defaults to the first four pins if an argument is not given. Args: self (JLink): the ``JLink`` instance pins (list): indices of the GPIO pins whose states are requested Returns: ...
Sets the state for one or more user-controllable GPIOs. For each of the given pins, sets the the corresponding state based on the index. Args: self (JLink): the ``JLink`` instance pins (list): list of GPIO indices states (list): list of states to set Retu...
def gpio_set(self, pins, states): """Sets the state for one or more user-controllable GPIOs. For each of the given pins, sets the the corresponding state based on the index. Args: self (JLink): the ``JLink`` instance pins (list): list of GPIO indices state...
Unlocks the device connected to the J-Link. Unlocking a device allows for access to read/writing memory, as well as flash programming. Note: Unlock is not supported on all devices. Supported Devices: Kinetis Returns: ``True``. Raises: ...
def unlock(self): """Unlocks the device connected to the J-Link. Unlocking a device allows for access to read/writing memory, as well as flash programming. Note: Unlock is not supported on all devices. Supported Devices: Kinetis Returns: ...