grass valley developers

Home > APIs > AppServer API > Examples > Connection and System Status > Get Channel Status properties

Get Channel Status properties

Channel status is provided for each K2 channel primarily by channel objects which control hardware resources and timeline attributes. Additional status info is provided by the application that owns the channel. This includes a thumbnail, custom text, and a format string called the status template. Channel status can be accessed by any number of Channel Status properties: some reporting status, some providing it. Click here for a list of all Channel Status properties.

Note that if you need to get multiple properties it is more efficient to make one GetStatus call for all properties rather than multiple GetStatus calls for each property.

[C#]
// create a chanstatus object
string appName = "YourApplicationName";
string channel = "C1";
IChanStatus ichanStatus = iappServer.CreateChanStatus(appName, channel);

//////////////////////////
// get a single property
//////////////////////////
string timeremain = (string) ichanStatus.GetStatus("timeremainingstr");
Console.WriteLine("timeremain = " + timeremain);

///////////////////////////
// get multiple properties
///////////////////////////
string query = "ownerName+assetname+videoFormatStr";
object[] results = (object[]) ichanStatus.GetStatus(query);
foreach (object obj in results)
{
 Console.WriteLine("obj = " + obj);
}

// cleanup
ichanStatus.Dispose();
[C++]
IChanStatusPtr spChanStatus;
HRESULT hr = spAppServer->CreateChanStatus(_bstr_t("YourApplicationName"), 
 _bstr_t("C1"), &spChanStatus);
 
//////////////////////////
// get a single property
//////////////////////////
VARIANT varResult;
hr = spChanStatus->GetStatus(_bstr_t("timeremainingstr"), &varResult);

CString sTimeRemaining = varResult.bstrVal; 
printf("TimeRemaining: %s\n", sTimeRemaining);


///////////////////////////
// get multiple properties
///////////////////////////
hr = spChanStatus->GetStatus(_bstr_t("ownerName+assetname+videoFormatStr"), 
 &varResult);

SAFEARRAY *pArray = varResult.parray;
VARIANT *pVar = NULL;
long arrIndex[1];

// get the first property
arrIndex[0] = 0;
SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar);
String sOwnerName = pVar->bstrVal; 

// get the second property
arrIndex[0] = 1;
SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar);
CString sAssetName = pVar->bstrVal; 

// get the third property
arrIndex[0] = 2;
SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar);
CString sVideoFormat = pVar->bstrVal; 

printf("OwnerName: %s AssetName: %s VideoFormat: %s\n\n", sOwnerName, 
 sAssetName, sVideoFormat);