1. Grass Valley Product Support ......................................................................................................................... 3
2. About this document ........................................................................................................................................ 3
3. TX/MAM functions and syntax......................................................................................................................... 3
9.1 Cleaning up the library ........................................................................................................................... 29
10. Date & time functions ................................................................................................................................. 30
10.1 Converting a Cobalt time field to two strings containing resp. the time and date part .......................... 30
10.2 Converting human readable time and date string to a Cobalt time field ............................................... 31
10.3 Getting the current system time and converting to a Cobalt time field .................................................. 32
11.1 Creating a new main event with import fields and formats ....................................................................... 33
11.2 Checking if the asset indicated by asset_id is in a schedule with the time indicated by
start_timedate and end_timedate ...................................................................................................................... 36
This document applies to TX/MAM version 2.2, nexos version 3.0 and Channel Composer version
1.6 and higher.
The K2 Edge Protocol Manual describes how to launch Channel Composer templates on nexos.
3. TX/MAM functions and syntax
Applets are written in C. The extension for applet files is .app. To be able to retrieve information from
the TX/MAM database, a library (libcolbalt.so) and a header file (cobalt.h) are available on request.
Following functions are available in the library:
Initialize the library
Database search functions
Retrieve functions
Update functions
Finalization functions
Date & time functions
Scheduling functions
Utility functions
When defining an applet in Channel Composer, make sure to specify the parameters that are used
by the applet.
Use the functions described in this section to search the database.
A search command consists of a number (>=1) of criteria that constitute the query that will be used to
match the records. Criteria can be used with the 'and' and 'or' logical operators. The result of a search
command is a list of IDs of records that matched the criteria.
Most criteria can only use fields that reside in the same table. SQL-criteria are an exception to this
rule.
Restrict the number of records in the result list as much as possible, especially when retrieving a
main_event from a Playlist. Too many records will result in a failure on the call. Returning a great
number of records can have a negative effect on system performance.
6.1 Clearing all criteria used in a previous search
int cob_criteria_clear( void );
Parameters
No parameters required
Result
The result of the function is an integer with the following values:
Example
cob_criteria_clear(); /* continue with the rest of the applet */
The table from which to use the field, e.g. "asset_element".
char *value
The SQL-query e.g. "select id, save_stamp from asset_element where
status_int = 1".
Value
Description
0
Success, the criterion has been added
-1
Failure, the criterion could not be added
6.5 Adding a criterion that contains a SQL-query
The SQL-query can only be a 'read only' query and should always return the fields 'ID' and
'SAVE_STAMP'. For a reference on the SQL 'select' statement, please refer to
http://www.ibphoenix.com/downloads/60LangRef.zip
The values to compare the fields with can be put directly into the SQL-statement (e.g. “where
id_Playlist = 1”), except when the field is a string field. In this case the value should be passed using
a parameter. This means that the SQL-statement will contain for example “where asset_string = :asset_string” and the cob_criteria_add_sqlparam function will be used to provide the
value, for example cob_criteria_add_sqlparam( “asset_element”, “asset_string”,”Clips” ).
A cob_criteria_add_sqlquery() should only be executed once for every
cob_get_id_lis()call. Multiple parameters can be added per cob_get_id_list()call.
int cob_criteria_add_sqlquery( char *table, char *value );
Parameters
Result
The result of the function is an integer that can have following values:
Example
This example will retrieve a list of all asset_elements with an asset_string value that equals "Clips"
and with status_int value that equals 1:
cob_criteria_clear();
cob_criteria_add_sqlquery( "asset_element","select id,savestamp from asset_element where ”
"asset_string = :asset_string and status_int=1" );