Page 1 of 1

How to use DDMODAPI_START_EPG?

Posted: Thu May 15, 2008 5:46 am
by fredx21
I'd like to know how to use the DDMODAPI_START_EPG api.

1) Is this syntax valid: SendMessage(hWndDvbDream, WM_MODULE_MSG, DDMODAPI_START_EPG, (LPARAM)&CbEpgInfo); where CbEpgInfo's declaration is int __stdcall CbEpgInfo(TEPGInfo* pEpgInfo)?
2) When is this module message call allowed?
3) Does this message has to be re-sent after every channel change in order to continue receiving EPG updates?

Thanx,
Fred

Posted: Thu May 15, 2008 6:14 am
by yeyotheiron
This may be an idea

...

function OnGetModuleInfo(ModuleInfo: PModuleInfo): BOOL; stdcall; export;
begin
ModuleInfo^.dwModuleAPI:= MODULE_API_1_7;
ModuleInfo^.szModuleName:= APP_NAME;
ModuleInfo^.szModuleAuthor:= APP_AUTHOR;
ModuleInfo^.szModuleEmail:= '';
ModuleInfo^.dwModuleVer:= APP_dwModuleVer;
ModuleInfo^.wShorCut:= 0;
ModuleInfo^.dwModuleType:= MODTYPE_EPG;
ModuleInfo^.dwRequiredDDver:= $01040000; //requires DD v1.4
Result:= False;
end;

...

function EPGCallback(pepg: PEPGInfo): Integer; stdcall;
var
_E: TEPGInfo;
begin
Result:= 0;
case EPGCounter mod 4 of
0: FormMain.sb_Info.Panels[0].Text:= '-';
1: FormMain.sb_Info.Panels[0].Text:= '\';
2: FormMain.sb_Info.Panels[0].Text:= '-';
3: FormMain.sb_Info.Panels[0].Text:= '/';
end;
Inc(EPGCounter);
FormMain.sb_Info.Panels[3].Text:= IntToStr(EPGCounter);
_E:= pepg^;
with FormMain.cds_EPG do
begin
if FindKey([_E.wSat, _E.wNetID, _E.wSID, _E.wEventID]) then
begin
Inc(EPGCounterUn);
FormMain.sb_Info.Panels[2].Text:= IntToStr(EPGCounterUn);
end
else
begin
Append;
FieldByName('Sat').AsInteger:= _E.wSat;
FieldByName('NetID').AsInteger:= _E.wNetID;
FieldByName('SID').AsInteger:= _E.wSID;
FieldByName('EventID').AsInteger:= _E.wEventID;
FieldByName('StartTime').AsInteger:= _E.dwStartTime;
FieldByName('Duration').AsInteger:= _E.dwDuration;
FieldByName('EventName').AsString:= _E.EventName;
FieldByName('ShortDescr').AsString:= _E.ShortDescr;
FieldByName('ExtendedDescr').AsString:= _E.ExtendedDescr;
Post;
end;
FormMain.sb_Info.Panels[1].Text:= IntToStr(RecordCount);
end;
end;

procedure TFormMain.bbtn_StartEPGClick(Sender: TObject);
var
_R: Integer;
begin
_R:= SendMessage(DDHwnd, WM_MODULE_MSG, DDMODAPI_START_EPG, Integer(@EPGCallback));
m_Log.Lines.Insert(0, Format('DDMODAPI_START_EPG = %d', [_R]));
end;

procedure TFormMain.bbtn_StopEPGClick(Sender: TObject);
var
_R: Integer;
begin
_R:= SendMessage(DDHwnd, WM_MODULE_MSG, DDMODAPI_STOP_EPG, 0);
m_Log.Lines.Insert(0, Format('DDMODAPI_STOP_EPG = %d', [_R]));
cds_EPG.SaveToFile('C:\epg.xml', dfXMLUTF8);
end;

Posted: Thu May 15, 2008 7:33 am
by fredx21
Thank you, this will help.

Re: How to use DDMODAPI_START_EPG?

Posted: Fri May 16, 2008 9:53 pm
by rel
2) When is this module message call allowed?
anywhere, after DD initialization. The best place is to call it in AfterChChange()
3) Does this message has to be re-sent after every channel change in order to continue receiving EPG updates?
Yes

Posted: Wed May 28, 2008 10:35 pm
by bogiemaker
yeyotheiron
Thank you for the fine example.

After implementing the EPG code I get the extended description on one provider (B3V) but not on the other provider.

Does anyone have an idea on why this might happen?

Thank You
BM