grass valley developers

Home > APIs > AppServer API > Examples > File Transfers > Transfer a File

Transfer a File

To transfer a file using the TransferQueue, add a transfer item to the queue by calling:

void AddXfrItem(
string srcUml,
string destUml,
string type,
out int token
)

The Source and Destination UMLs are Uniform Media Locators which are specified here.

The type string, depending on the type of transfer, can be one of these values: "Send to Stream", "Send to File", or "Import File". See here Transfer Clips: Importing and Exporting Various File Types for examples of when to use which type of transfer.

Token is an integer value that is returned from the AddXfrItem command. This token can then be used for querying the transfer item's status (more details below).

Example:

Below is an example for adding a request to the TransferQueue to transfer a clip between two K2s. The example also shows how to query properties of the transfer item.

See Transfer clips: Importing and Exporting Various File Types for more AddXfrItem examples of transferring clips and importing & exporting GXF and MXF files.

See Transfer Item properties for a list of all transfer item properties that may be queried.

[C#]
// create a transfer queue object
IXfrQueue ixfrQueue = iappServer.CreateXfrQueue(appName);

// transfer a clip from between two K2s; get a token back from the
// TransferQueue so that we can query properties of the transfer
int token;
ixfrQueue.AddXfrItem(
"K2-1/explodedFile/V:/default/Clip",
"K2-2/explodedFile/V:/default/Clip",
"Send to Stream",
out token); // token for querying properties

// query for a property
object data;
ixfrQueue.GetXfrItemProperty(token, "percentage", out data);
Console.WriteLine("percentage = " + data);

// get xml data about the transfer item
string xmlData;
ixfrQueue.GetXfrItemXml(token, out xmlData);
Console.WriteLine("result = " + xmlData);
[C++]
// create a transfer queue object
IXfrQueuePtr spXfrQueue;
HRESULT hr = spAppServer->CreateXfrQueue(m_bstrAppName, &spXfrQueue);

// transfer a clip from between two K2s; get a token back from the
// TransferQueue so that we can query properties of the transfer
long token;
spXfrQueue->AddXfrItem(
 _bstr_t("K2-1/explodedFile/V:/default/Clip"),
 _bstr_t("K2-2/explodedFile/V:/default/Clip"),
 _bstr_t("Send to Stream"),
 &token); // token for querying properties

// query for a property
VARIANT data;
spXfrQueue->GetXfrItemProperty(token, _bstr_t("Percentage"), &data);
long nPercentage = data.lVal;
printf("percentage = %d\n", nPercentage);

// get xml data about the transfer item
BSTR xmlData;
spXfrQueue->GetXfrItemXml(token, &xmlData);

CString sXmlData = xmlData;
printf("xmlData = %s\n\n", sXmlData);