7543e451496d36ce5d6a8e88badf8afcf97f775f
[openblackhole/openblackhole-enigma2.git] / main / enigma.cpp
1 #include <stdio.h>
2 #include <libsig_comp.h>
3 #include <lib/base/ebase.h>
4 #include <lib/base/eerror.h>
5 #include <lib/base/init.h>
6 #include <lib/base/init_num.h>
7
8 #include <lib/dvb/dvb.h>
9 #include <lib/dvb/db.h>
10 #include <lib/dvb/isection.h>
11 #include <lib/dvb/esection.h>
12 #include <lib/dvb_si/pmt.h>
13 #include <lib/dvb/scan.h>
14 #include <unistd.h>
15
16 #include <lib/service/iservice.h>
17
18 class eMain: public eApplication, public Object
19 {
20         eInit init;
21         
22         ePtr<eDVBResourceManager> m_mgr;
23         ePtr<iDVBChannel> m_channel;
24         ePtr<eDVBDB> m_dvbdb;
25
26         ePtr<iPlayableService> m_playservice;
27 public:
28         eMain()
29         {
30                 init.setRunlevel(eAutoInitNumbers::main);
31                 m_dvbdb = new eDVBDB();
32                 m_mgr = new eDVBResourceManager();
33                 m_mgr->setChannelList(m_dvbdb);
34                 
35                 ePtr<eServiceCenter> service_center;
36                 eServiceCenter::getInstance(service_center);
37
38                 if (service_center)
39                 {
40                         eServiceReference ref("2:0:1:0:0:0:0:0:0:0:/");
41                         ePtr<iListableService> lst;
42                         if (service_center->list(ref, lst))
43                                 eDebug("no list available!");
44                         else
45                         {
46                                 std::list<eServiceReference> list;
47                                 if (lst->getContent(list))
48                                         eDebug("list itself SUCKED AROUND!!!");
49                                 else
50                                         for (std::list<eServiceReference>::const_iterator i(list.begin());
51                                                 i != list.end(); ++i)
52                                                 eDebug("%s", i->toString().c_str());
53                         }
54                 }
55                 
56                 eServiceReference ref("1:0:1:6de2:44d:1:c00000:0:0:0:");
57                 
58                 if (service_center)
59                 {
60                         if (service_center->play(ref, m_playservice))
61                                 eDebug("play sucked around!");
62                         else
63                                 eDebug("play r00lz!");
64                 } else
65                         eDebug("no service center: no play.");
66         }
67         
68         ~eMain()
69         {
70                 
71         }
72 };
73
74 #ifdef OBJECT_DEBUG
75 int object_total_remaining;
76
77 void object_dump()
78 {
79         printf("%d items left\n", object_total_remaining);
80 }
81 #endif
82
83 int main()
84 {       
85 #ifdef OBJECT_DEBUG
86         atexit(object_dump);
87 #endif
88         eMain app;
89         return app.exec();
90 }