How to use DDMODAPI_START_EPG?

Module API help / support section for programmers.

Moderators: Dreamer, FredB, X05

fredx21
Not too shy to talk
Posts: 18
Joined: Wed Feb 20, 2008 10:22 am

How to use DDMODAPI_START_EPG?

Postby fredx21 » Thu May 15, 2008 5:46 am

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

yeyotheiron
Not too shy to talk
Posts: 13
Joined: Thu Aug 16, 2007 10:03 am

Postby yeyotheiron » Thu May 15, 2008 6:14 am

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;
fredx21
Not too shy to talk
Posts: 18
Joined: Wed Feb 20, 2008 10:22 am

Postby fredx21 » Thu May 15, 2008 7:33 am

Thank you, this will help.
User avatar
rel
relocation
Posts: 2051
Joined: Fri Jun 16, 2006 9:50 am

Re: How to use DDMODAPI_START_EPG?

Postby rel » Fri May 16, 2008 9:53 pm

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
DVB Dream - because I have to dream about having time to code it
bogiemaker
Posts: 2
Joined: Mon Jun 04, 2007 11:19 am

Postby bogiemaker » Wed May 28, 2008 10:35 pm

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
Genpix Skywalker-1, TwinHan 1025

Return to “Module / Plugin Programming”

Who is online

Users browsing this forum: No registered users and 1 guest