aja.embedded.rest.kipro (version rc1, Tue Mar 13 14:17:51 PDT 2012)
index
/home/shaunc/trunk-python-api/trunk/aja_python_api-4.1.1/aja/embedded/rest/kipro.py

Ki-Pro Rest Client
 
Executes commands against a Ki-Pro family unit at the specified URL.
See the demo() for examples of how to use the client.
Supports Ki-Pro firmware revisions 3.0 and greater.
 
Module usage:
 
$ python
>>> from aja.embedded.rest.import kipro
>>> client = kipro.Client('http://YourKiPro')
>>> client.getFirmwareVersion()
'4.0.0.9'
>>> client.record()
>>> client.play()
>>> client.getWriteableParameters()
 
 
Commandline Usage: rest.py [options]
 
Options:
       -u | --url (URL of Ki-Pro unit)
       -h | --help (this message)
 
Examples:
       rest.py -u 90.0.6.6
 
Copyright (C) 2012 AJA Video Systems, Inc.

 
Modules
       
json
re
sys
threading
urllib
urllib2

 
Classes
       
aja.embedded.rest.base.BaseClient
Client
threading.Thread(threading._Verbose)
TimecodeListener

 
class Client(aja.embedded.rest.base.BaseClient)
    This class understands the kipro REST api.
Quickstart:
 
$ python
>>> from aja.embedded.rest.kipro import *
>>> client = Client('http://YourKiPro')
>>> client.getFirmwareVersion()
'4.0.0.9'
>>> client.record()
>>> client.play()
>>> client.getWriteableParameters()
 
  Methods defined here:
__init__(self, url, cacheRawParameters=True)
cueToTimecode(self, timecode)
Cue to the supplied timecode in the current clip.
Warning: Wraps if you use a timecode beyond the end of the clip.
fastForward(self)
Advance quickly while playing.
fastReverse(self)
Playing in reverse quickly.
getCurrentClipName(self)
Convenience method to get the current clip.
getPlaylists(self)
Get the current playlists.
getTimecodeWithSynchronousCall(self)
Get the current timecode value. Most aplications will want to connect() then run wait_for_config_events in a while()
loop in its own thread. See TimecodeListener for a convenient way to do that.
WARNING: This call can take a long time. It will not return until timecode changes or is updated with the same
value (like when stop is pressed).
getTransporterState(self)
Convenience method for getting the current transporter state.
Returns (state_value, human_readable_string)
goToClip(self, clipName)
This selects a clip as the current clip.
nextClip(self)
Go to the next clip in the current playlist.
play(self)
Convenience method to start playback.
playReverse(self)
Convenience method to playback in reverse.
previousClip(self)
Go to the previous clip in the current playlist.
record(self)
Convenience method to start the Transporter recording.
sendTransportCommandByDescription(self, term)
Compares term to the descriptions of valid transport commands sends that command if found.
singleStepForward(self)
Move one frame forward.
singleStepReverse(self)
Move one frame backward.
stop(self)
Stop a record or pause playback (send twice to stop playback)

Data and other attributes defined here:
__author__ = 'Support <support@aja.com>'
__copyright__ = 'Copyright (C) 2009 AJA Video Systems, Inc.'
__date__ = '$Date: 2012-11-06 13:34:08 -0800 (Tue, 06 Nov 2012) $'
__license__ = 'Proprietary'
__version__ = '$Revision: 44 $'

Methods inherited from aja.embedded.rest.base.BaseClient:
asPython(self, response)
Convert a Ki-Pro response into a python object
(usually an array of dictionaries depending on the json).
cleanResponse(self, response)
This deals with some historical peculiarities in Ki-Pro JSON formatting.
connect(self)
This is only used for listening for event streams (primarily timecode).
decodeVersion(self, versionBits)
The version is reported as a 32 bit integer.
Returns a human readable version number decode this into four dotted octets.
encodeVersion(self, versionString)
Converts a dotted string version number to an integer suitable for matching to 
the version number returned by the API.
getFirmwareVersion(self)
Convenience method for getting the current firmware version.
getFreshFirmwareVersion(self)
Goes back to the config to get the actual current firmware version. 
(Shows changed version number if Software Update has happened)
getParameter(self, param_id)
Returns a 2-tuple: (the http error code, the value of the param_id
- or an empty string if none or not found).
getRawParameter(self, param_id)
Returns (http error code, a json string containing all the information about the param including its current value)
getRawParameters(self, cacheRawParameters=True)
Get everything the Ki-Pro knows about all parameters.
This is list will be cached unless cacheRawParameters is set to false ("not recommended") so treat this
as a stale list of available parameters and valid settings. Things that won't change at runtime.
See getParameter() for current state of individual parameters.
getReadableParameters(self)
Get all parameters and their descriptions.
This is list may be cached and so should be treated as stale.
See getParameter() for current state
getSelected(self, response)
The JSON returned is a list of all possible values for enum parameters with 
the current value marked as selected. Integer and string parameters
are returned in the same way with just one entry in the list.
Return the selected value entry in the list.
getSystemName(self)
Returns the human readable-system name.
getValidSettingsForParameter(self, param_id)
Returns a list of
getWriteableParameters(self)
Returns a list of dictionaries containing all of the params which are available for writing.
The key value is the param_id used for requests and the value is the description if any.
This is list may be cached and so should be treated as stale.
See getParameter() for current state
is_alive(self)
is_alive() will return True if the AJA device can be contacted.
This function is useful for determining whether a device has completely booted.
setParameter(self, param_id, value)
Set a single parameter value.
waitForConfigEvents(self, connectionid=None)
This is primarily used to get timecode.

 
class TimecodeListener(threading.Thread)
    This listener creates a connection to a ki-pro unit and listens for timecode event updates.
WARNING: Timecode events may not occur every frame. If you need a frame accurate timecode, consider using
RS422 or setting timecode as a record trigger.
 
quickstart:
 
python$
  >>> from aja.embedded.rest.kipro import *
  >>> l = TimecodeListener('http://YourKiPro')
  >>> l.start()
  >>> print l.getTimecode()
 
 
Method resolution order:
TimecodeListener
threading.Thread
threading._Verbose
__builtin__.object

Methods defined here:
__init__(self, url)
Create a TimecodeListener.
Use start() to start it listening.
getTimecode(self)
Thread safe.
run(self)
stop(self)
Tell the listener to stop listening and the thread to exit.

Data and other attributes defined here:
__author__ = 'Support <support@aja.com>'
__copyright__ = 'Copyright (C) 2009 AJA Video Systems, Inc.'
__date__ = '$Date: 2012-11-06 13:34:08 -0800 (Tue, 06 Nov 2012) $'
__license__ = 'Proprietary'
__version__ = '$Revision: 44 $'

Methods inherited from threading.Thread:
__repr__(self)
getName(self)
isAlive(self)
isDaemon(self)
is_alive = isAlive(self)
join(self, timeout=None)
setDaemon(self, daemonic)
setName(self, name)
start(self)

Data descriptors inherited from threading.Thread:
daemon
ident
name

Data descriptors inherited from threading._Verbose:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
demo(url)
Demonstrates how to use the client and grabs some useful information.
main(argv)
usage()

 
Data
        __author__ = 'Support <support@aja.com>'
__copyright__ = 'Copyright (C) 2009 AJA Video Systems, Inc.'
__date__ = 'Tue Mar 13 14:17:51 PDT 2012'
__license__ = 'Proprietary'
__version__ = 'rc1'

 
Author
        Support <support@aja.com>