[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [tcf-dev] Phyton integration: dprintf service?
|
Hi,
I am about to merge our code base into the opensource, and we added the
dprintf service and proxy.
As this should occur at the end of next week, I attach the dprintf.py
(to drop in the tcf/services directory) and the DPrintfProxy.py (to
drop in the tcf/services/remote directory).
BTW, the service is not the service implementation, but the service
interface.
Hope this helps
DERF
On 07/05/2016 04:16 PM, Konrad Anheim wrote:
Hi,
I’m currently looking into the TCF Python library. The library contains
Python classes for each of the TCF services. However, I am missing a
Python class covering dprintf service or is it simply covered elsewhere?
cheers,
Conny
_______________________________________________
tcf-dev mailing list
tcf-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tcf-dev
# *****************************************************************************
# * Copyright (c) 2014 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
# * http://www.eclipse.org/legal/epl-v10.html
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
# *****************************************************************************
"""TCF DPrintf service interface.
Service Methods
---------------
.. autodata:: NAME
.. autoclass:: DPrintfService
getName
^^^^^^^
.. automethod:: DisassemblyService.getName
open
^^^^^^^^^^^
.. automethod:: DPrintfService.open
close
^^^^^^^^^^^
.. automethod:: DPrintfService.close
"""
from .. import services
NAME = "DPrintf"
"""DPrintf service name."""
class DPrintfService(services.Service):
def getName(self):
"""Get this service name.
:returns: The value of string :const:`NAME`
"""
return NAME
def open(self):
"""Open a virtual stream to get DPrintf output.
:returns: The ID of the stream :basestring: `stream_id`
"""
raise NotImplementedError("Abstract method")
def close(self):
"""Close DPrintf virtual stream opened by this client.
:returns: Pending command handle, can be used to cancel the command.
"""
raise NotImplementedError("Abstract method")
class DoneOpen(object):
"""Call back interface for 'open' command."""
def doneOpen(self, token, error, stream_id):
"""Called when DPrintf open is done.
:param token: command handle.
:param error: error object or None.
:param stream_id: ID of the DPrintf stream.
"""
pass
class DoneClose(object):
"""Call back interface for |close| command."""
def doneClose(self, token, error):
"""Called when DPrintf close is done.
:param token: Pending command handle.
:param error: Error description if operation failed, **None** if
succeeded.
"""
pass
# *****************************************************************************
# * Copyright (c) 2014 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
# * http://www.eclipse.org/legal/epl-v10.html
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
# *****************************************************************************
from .. import dprintf
from ...channel.Command import Command
class DPrintfProxy(dprintf.DPrintfService):
def __init__(self, channel):
self.channel = channel
self.listeners = {}
def getName(self):
return (dprintf.NAME)
def open(self, done, arg=None):
done = self._makeCallback(done)
service = self
class OpenCommand(Command):
def __init__(self):
super(OpenCommand, self).__init__(service.channel, service,
"open", (arg,))
def done(self, error, args):
if not error:
assert len(args) == 2
error = self.toError(args[0])
vs = args[1]
done.doneOpen(self.token, error, vs)
return OpenCommand().token
def close(self, done):
done = self._makeCallback(done)
service = self
class CloseCommand(Command):
def __init__(self):
super(CloseCommand, self).__init__(service.channel, service,
"close", None)
def done(self, error, args):
if not error:
assert len(args) == 1
error = self.toError(args[0])
done.doneClose(self.token, error)
return CloseCommand().token