//v0.3, 18-02-2017, data all UTF-8 Interface: #if defined(_WIN32) #define STDCALL __stdcall #else #define STDCALL __attribute__ ((stdcall)) #endif typedef int (STDCALL *SendToParentCallback)(char *value, void *user_param); //typedef for SendToParent callback function. It takes json array string, zerro terminated as a parameter extern "C" int STDCALL Load(const char* module_name, SendToParentCallback callback, void* user_param); This function is called at the start. It takes parent callback as a parameter. The callback is valid until Unload function exits. Also user_param is given, which comes back as a parameter in callback function. extern "C" void STDCALL Unload() extern "C" int STDCALL ReceiveFromParent(char *value); // json array string, zero terminated extern "C" void STDCALL PidData(unsigned char *data, int datalen); // unsigned char, [188 * x] extern "C" void STDCALL RawData(unsigned char *data, int datalen); // unsigned char, [188 * x] return int 0 = accept json, int > 0 not accept json sends error // ------------------------------------------------------------- Json commands: - json receive command "CMD":"CHANNEL_CHANGE" "NAME":"NPO 1 (HD)" // Optional "SID":"1212" "PMT":"0056" "NIT":"0010" // Optional "TID":"0100" // Optional "PMT_DATA":"02B07C4A61D9000 ... " // Optional "CAT_DATA":"01B027FFFFEF000 ... " // Optional - json send command "CMD":"KEY_CHANGE "MUX":"0" // Optional "KEY_EVEN":"0011223344556677" // Optional "KEY_ODD":"889900AABBCCDDEE" // Optional - json send command "CMD":"START_PIDS" "PIDS":"0001 0013 1301" - json send command "CMD":"STOP_PIDS" "PIDS":"0001 0013 1301" - json send/receive command "CMD":"NOP" - json send/receive command "CMD":"ERROR" NR":"1" // Optional, 1 = json-error, 2 = wrong-pid, 3 = wrong-key, etc.... "MSG":"Wrong pid" // Optional - json send/receive command "CMD":"GET_VERSION" - json receive command "CMD":"VERSION" "APPLICATION_NAME":"DVBApp" // Optional "VERSION":"1.0" // Optional "JSON":"0.3" // Optional // ------------------------------------------------------------- default flow: Load() ReceiveFromParent: [ { "CMD":"GET_VERSION" }, { "CMD":"CHANNEL_CHANGE", "NAME":"NPO 1 (HD)", "SID":"1212", "PMT":"0056", "NIT":"0010", "TID":"0100", "PMT_DATA":"02B07C4A61D90000E7D1F0110B02423F0E03C83D601006C00271C0040002E7D1F00502031A485F03E7DBF0060A046475740003E7DCF0060A04474F530306E835F0075605647574090006E836F00A5908647574100002000206E837F014590838383820000200025908647574200002000205E899F0056F030010E07D63081B", "CAT_DATA":"01B027FFFFEF000009041801E06409041850E06509040602E06609040604E06709040606E068CBF90119" } ] SendToParent: [ { "CMD":"VERSION", "APPLICATION_NAME":"DVBJCAM", "VERSION":"0.0.0.5", "JSON":"0.3" }, { "CMD":"GET_VERSION" }, { "CMD":"START_PIDS", "PIDS":"0001 0033 0066" } ] ReceiveFromParent: [ { "CMD":"VERSION", "APPLICATION_NAME":"DVBAPP", "VERSION":"1.0", "JSON":"0.3" } ] SendToParent: [ { "CMD":"KEY_CHANGE, "KEY_EVEN":"0011223344556677", "KEY_ODD":"889900AABBCCDDEE" } ] SendToParent: [ { "CMD":"KEY_CHANGE, "KEY_EVEN":"BB9988776655443322" } ] SendToParent: [ { "CMD":"KEY_CHANGE, "KEY_ODD":"2233445566778899BB" } ] ReceiveFromParent: [ { "CMD":"CHANNEL_CHANGE", "NAME":"RTL4 (HD)", "SID":"1313", "PMT":"0057", "NIT":"0020", "TID":"0200", "PMT_DATA":"02B07C4A61D90000E7D1F0110B02423F0E03C83D601006C00271C0040002E7D1F00502031A485F03E7DBF0060A046475740003E7DCF0060A04474F530306E835F0075605647574090006E836F00A5908647574100002000206E837F014590838383820000200025908647574200002000205E899F0056F030010E07D63081B", } ] SendToParent: [ { "CMD":"START_PIDS", "PIDS":"0034 0035" } ] SendToParent: [ { "CMD":"START_PIDS", "PIDS":"0086" } ] SendToParent: [ { "CMD":"KEY_CHANGE, "KEY_EVEN":"8811223344556600", "KEY_ODD":"889900AABBCCDD99" } ] Unload()