Player APIs (BrightScript & Ja...
...
Object Reference
Input/Output Objects

roChannelManager

18min
you can use this object to manage rf channel scanning and tuning the rovideoplayer method also has channel scanning capabilities object creation the rochannelmanager object is created with no parameters createobject("rochannelmanager") ifuserdata setuserdata(user data as object) sets the user data that will be returned when events are raised getuserdata() as object returns the user data that has previously been set via setuserdata() it will return invalid if no data has been set ifmessageport setport(port as romessageport) ifchannelmanager the ifchannelmanager interface provides both a synchronous and asynchronous api synchronous api scan(parameters as roassociativearray) as boolean performs a channel scan on the rf input for both atsc and qam frequencies and builds a channel map based on what it finds the rochannelmanager object stores a list of all channels that are obtained using the createchanneldescriptor() method (described below) the list is cleared on each call to scan() by default, but this behavior can be overridden each channel takes approximately one second to scan; you can limit the scope of the channel scan with the following parameters \["channelmap"] = "atsc" or "qam" limits the frequency scan to either qam or atsc \["modulationtype"] = "qam64" or "qam256" limits the modulation type of the scan to qam64 or qam256 \["firstrfchannel"] = integer and/or \["lastrfchannel"] = integer limits the scan to the specified range of channels the high end of the channel range is an optional parameter \["channelstore"] = "discard all" or "merge" controls how the script handles previous channel scan information the default setting is discard all, which clears all channel data prior to scanning on the other hand, merge overwrites the data only for channels specified in the scan getchannelcount() as integer returns the number of found channels clearchanneldata() as boolean clears all stored channel scanning data, including that which persists in the registry this method also cancels any asyncscan() calls that are currently running getcurrentsnr() as integer returns the snr (in centibels) of the currently tuned channel exporttoxml() as string serializes the contents of rf channels into xml you can write the xml to a file that can be used at a later point on the same or other units see below for an example of xml output importfromxml(a as string) as boolean retrieves the rf channel contents stored as xml the formatting of the xml is controlled using version tags example \<?xml version="1 0" encoding="utf 8" standalone="yes" ?> \<!doctype boost serialization> \<boost serialization signature="serialization archive" version="7"> \<channellist class id="0" tracking level="0" version="0"> \<channelcount>2\</channelcount> \<channel class id="1" tracking level="0" version="0"> \<rfchannel>42\</rfchannel> \<modulationtype>7\</modulationtype> \<spectralinversion>0\</spectralinversion> \<majorchannelnumber>1\</majorchannelnumber> \<minorchannelnumber>1\</minorchannelnumber> \</channel> \<channel> \<rfchannel>42\</rfchannel> \<modulationtype>7\</modulationtype> \<spectralinversion>0\</spectralinversion> \<majorchannelnumber>1\</majorchannelnumber> \<minorchannelnumber>2\</minorchannelnumber> \</channel> \</channellist> enablescandebug(filename as string) as boolean allows all scan debugging to be written to a text file by default, there is no debug output from a scan you can close the debug file by passing an empty string example c=createobject("rochannelmanager") c enablescandebug("tmp\ /scandebug txt") v = createobject("rovideoplayer") aa = createobject("roassociativearray") aa\["rfchannel"] = 12 aa\["virtualchannel"] = "24 1" print v playfile(aa) c enablescandebug("") createchanneldescriptor(a as object) as object creates an associative array that can either be passed to the rovideoplayer playfile() method (to tune to a channel) or parsed for metadata the generated channel object can be based on one of the following index \["channelindex"] = 0 virtual channel number as a string in an associative array \["virtualchannel"] = "12 1" channel name as a string \["channelname"] = "kcbs" channels are sorted internally by virtual channel, so you could use a channel index script to implement standard channel up/down behavior these are the entries generated in the array virtualchannel channelname centrefrequency modulationtype videopid videocodec audiopid audiocodec spectralinversion channelmap firstrfchannel lastrfchannel the last three entries in this array allow you to use the same roarray as a parameter for scan() and playfile() the first and last rf channel values are set to the same value so that only one rf channel will be scanned this kind of scan can be performed at the same time as playing the channel because it doesn’t require retuning example c=createobject("rochannelmanager") aa=createobject("roassociativearray") aa\["channelmap"] = "qam" aa\["firstrfchannel"] = 10 aa\["lastrfchannel"] = 15 c scan(aa) cinfo = createobject("roassociativearray") cinfo\["channelindex"] = 0 desc = c createchanneldescriptor(cinfo) print desc v = createobject("rovideoplayer") v playfile(desc) c scan(desc) asynchronous api asyncscan(parameters as roassociativearray) as boolean begins a channel scan on the rf input and returns the results immediately otherwise, the behavior and parameters of this method are identical to scan() when completed or cancelled, asyncscan() generates an rochannelmanagerevent , which supports ifuserdata and outputs two types of event 0 – scan complete generated upon the completion of a scan no extra data is supplied 1 – scan progress generated upon every tune that is performed during the scan getdata() returns the percentage complete of the scan cancelscan() as boolean cancels any asynchronous scans that are currently running this method does not generate an rochannelmanagerevent synchronous example c = createobject("rochannelmanager") ' scan the channels aa = createobject("roassociativearray") aa\["channelmap"] = "atsc" aa\["firstrfchannel"] = 12 aa\["lastrfchannel"] = 50 c scan(aa) ' start at the first channel index = 0 cinfo = createobject("roassociativearray") cinfo\["channelindex"] = index desc = c createchanneldescriptor(cinfo) ' play the first channel v = createobject("rovideoplayer") v playfile(desc) ' play the second channel index = index + 1 cinfo\["channelindex"] = index desc = c createchanneldescriptor(cinfo) v playfile(desc) asynchronous example c = createobject("rochannelmanager") p = createobject("romessageport") c setport(p) ' scan the channels aa = createobject("roassociativearray") aa\["channelmap"] = "atsc" aa\["firstrfchannel"] = 12 aa\["lastrfchannel"] = 50 c asyncscan(aa) loop msg = wait(2000,p) if msg = 0 then goto scan complete goto loop scan complete ' start at the first channel index = 0 cinfo = createobject("roassociativearray") cinfo\["channelindex"] = index desc = c createchanneldescriptor(cinfo) ' play the first channel v = createobject("rovideoplayer") v playfile(desc) ' rescan the current channel, and update the desc\["channelstore"] = merge c scan(desc)