set platform profile and check application version.
authorkos <kos@dev3>
Fri, 31 Aug 2012 10:40:24 +0000 (19:40 +0900)
committerkos <kos@dev3>
Fri, 31 Aug 2012 10:40:24 +0000 (19:40 +0900)
lib/dvb/pmt.cpp
lib/dvb/pmt.h
lib/python/Plugins/Extensions/HbbTV/plugin.py
lib/python/Screens/InfoBarGenerics.py

index 5b19ebd..74f896f 100644 (file)
@@ -223,13 +223,22 @@ void saveData(int orgid, unsigned char* data, int sectionLength)
        close(fd);
 }
 
        close(fd);
 }
 
+#include <dvbsi++/application_profile.h>
+#include <dvbsi++/application_descriptor.h>
+#define PACK_VERSION(major,minor,micro) (((major) << 16) + ((minor) << 8) + (micro))
+#define UNPACK_VERSION(version,major,minor,micro) { \
+       major = (version)&0xff; \
+       minor = (version>>8)&0xff; \
+       micro = (version>>16)&0xff; \
+}
 void eDVBServicePMTHandler::AITready(int error)
 {
        eDebug("AITready");
        ePtr<eTable<ApplicationInformationSection> > ptr;
        if (!m_AIT.getCurrent(ptr))
        {
 void eDVBServicePMTHandler::AITready(int error)
 {
        eDebug("AITready");
        ePtr<eTable<ApplicationInformationSection> > ptr;
        if (!m_AIT.getCurrent(ptr))
        {
-               int orgid = 0, appid = 0;
+               short profilecode = 0;
+               int orgid = 0, appid = 0, profileVersion = 0;
                m_ApplicationName = m_HBBTVUrl = "";
 
                eraseHbbTVApplications(&m_HbbTVApplications);
                m_ApplicationName = m_HBBTVUrl = "";
 
                eraseHbbTVApplications(&m_HbbTVApplications);
@@ -259,7 +268,21 @@ void eDVBServicePMTHandler::AITready(int error)
                                                switch ((*desc)->getTag())
                                                {
                                                case APPLICATION_DESCRIPTOR:
                                                switch ((*desc)->getTag())
                                                {
                                                case APPLICATION_DESCRIPTOR:
+                                               {
+                                                       ApplicationDescriptor* applicationDescriptor = (ApplicationDescriptor*)(*desc);
+                                                       ApplicationProfileList* applicationProfiles = applicationDescriptor->getApplicationProfiles();
+                                                       ApplicationProfileConstIterator interactionit = applicationProfiles->begin();
+                                                       for(; interactionit != applicationProfiles->end(); ++interactionit)
+                                                       {
+                                                               profilecode = (*interactionit)->getApplicationProfile();
+                                                               profileVersion = PACK_VERSION(
+                                                                       (*interactionit)->getVersionMajor(),
+                                                                       (*interactionit)->getVersionMinor(),
+                                                                       (*interactionit)->getVersionMicro()
+                                                               );
+                                                       }
                                                        break;
                                                        break;
+                                               }
                                                case APPLICATION_NAME_DESCRIPTOR:
                                                {
                                                        ApplicationNameDescriptor *nameDescriptor  = (ApplicationNameDescriptor*)(*desc);
                                                case APPLICATION_NAME_DESCRIPTOR:
                                                {
                                                        ApplicationNameDescriptor *nameDescriptor  = (ApplicationNameDescriptor*)(*desc);
@@ -314,7 +337,25 @@ void eDVBServicePMTHandler::AITready(int error)
                                                }
                                        }
                                }
                                                }
                                        }
                                }
-                               m_HbbTVApplications.push_back(new HbbTVApplicationInfo(controlCode, orgid, appid, hbbtvUrl, applicaionName));
+                               if(!hbbtvUrl.empty())
+                               {
+                                       char* uu = hbbtvUrl.c_str();
+                                       if(!strncmp(uu, "http://", 7) || !strncmp(uu, "dvb://", 6) || !strncmp(uu, "https://", 8))
+                                       {
+                                               switch(profileVersion)
+                                               {
+                                               case 65793:
+                                               case 66049:
+                                                       m_HbbTVApplications.push_back(new HbbTVApplicationInfo(controlCode, orgid, appid, hbbtvUrl, applicaionName, profilecode));
+                                                       break;
+                                               case 1280:
+                                               case 65538:
+                                               default:
+                                                       m_HbbTVApplications.push_back(new HbbTVApplicationInfo((-1)*controlCode, orgid, appid, hbbtvUrl, applicaionName, profilecode));
+                                                       break;
+                                               }
+                                       }
+                               }
                        }
                }
 
                        }
                }
 
@@ -392,12 +433,13 @@ PyObject *eDVBServicePMTHandler::getHbbTVApplications(void)
        {
                for(HbbTVApplicationInfoListConstIterator infoiter = m_HbbTVApplications.begin() ; infoiter != m_HbbTVApplications.end() ; ++infoiter)
                {
        {
                for(HbbTVApplicationInfoListConstIterator infoiter = m_HbbTVApplications.begin() ; infoiter != m_HbbTVApplications.end() ; ++infoiter)
                {
-                       ePyObject tuple = PyTuple_New(5);
+                       ePyObject tuple = PyTuple_New(6);
                        PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((*infoiter)->m_ControlCode));
                        PyTuple_SET_ITEM(tuple, 1, PyString_FromString((*infoiter)->m_ApplicationName.c_str()));
                        PyTuple_SET_ITEM(tuple, 2, PyString_FromString((*infoiter)->m_HbbTVUrl.c_str()));
                        PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong((*infoiter)->m_OrgId));
                        PyTuple_SET_ITEM(tuple, 4, PyInt_FromLong((*infoiter)->m_AppId));
                        PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong((*infoiter)->m_ControlCode));
                        PyTuple_SET_ITEM(tuple, 1, PyString_FromString((*infoiter)->m_ApplicationName.c_str()));
                        PyTuple_SET_ITEM(tuple, 2, PyString_FromString((*infoiter)->m_HbbTVUrl.c_str()));
                        PyTuple_SET_ITEM(tuple, 3, PyInt_FromLong((*infoiter)->m_OrgId));
                        PyTuple_SET_ITEM(tuple, 4, PyInt_FromLong((*infoiter)->m_AppId));
+                       PyTuple_SET_ITEM(tuple, 5, PyInt_FromLong((*infoiter)->m_ProfileCode));
                        PyList_Append(ret, tuple);
                        Py_DECREF(tuple);
                }
                        PyList_Append(ret, tuple);
                        Py_DECREF(tuple);
                }
index 9216adc..690932c 100644 (file)
@@ -98,11 +98,13 @@ public:
        int m_OrgId;
        int m_AppId;
        int m_ControlCode;
        int m_OrgId;
        int m_AppId;
        int m_ControlCode;
+       short m_ProfileCode;
        std::string m_HbbTVUrl;
        std::string m_ApplicationName;
 public:
        std::string m_HbbTVUrl;
        std::string m_ApplicationName;
 public:
-       HbbTVApplicationInfo(int controlCode, int orgid, int appid, std::string hbbtvUrl, std::string applicationName)
-               : m_ControlCode(controlCode), m_HbbTVUrl(hbbtvUrl), m_ApplicationName(applicationName), m_OrgId(orgid), m_AppId(appid)
+       HbbTVApplicationInfo(int controlCode, int orgid, int appid, std::string hbbtvUrl, std::string applicationName, int profileCode)
+               : m_ControlCode(controlCode), m_HbbTVUrl(hbbtvUrl), m_ApplicationName(applicationName), m_OrgId(orgid), 
+                 m_AppId(appid), m_ProfileCode(profileCode)
        {}
 };
 typedef std::list<HbbTVApplicationInfo *> HbbTVApplicationInfoList;
        {}
 };
 typedef std::list<HbbTVApplicationInfo *> HbbTVApplicationInfoList;
index 9ae4d2e..56e6b90 100644 (file)
@@ -557,7 +557,7 @@ class HbbTVWindow(Screen, InfoBarNotifications):
                <screen name="HbbTVWindow" position="0,0" size="1280,720" backgroundColor="transparent" flags="wfNoBorder" title="HbbTV Plugin">
                </screen>
                """
                <screen name="HbbTVWindow" position="0,0" size="1280,720" backgroundColor="transparent" flags="wfNoBorder" title="HbbTV Plugin">
                </screen>
                """
-       def __init__(self, session, url=None, cbf=None, useAIT=False):
+       def __init__(self, session, url=None, cbf=None, useAIT=False, profile=0):
                self._session = session
                eRCInput.getInstance().lock()
 
                self._session = session
                eRCInput.getInstance().lock()
 
@@ -569,6 +569,7 @@ class HbbTVWindow(Screen, InfoBarNotifications):
 
                self._url = url
                self._use_ait = useAIT
 
                self._url = url
                self._use_ait = useAIT
+               self._profile = profile
                self._cb_closed_func = cbf
                self.onLayoutFinish.append(self._layoutFinished)
 
                self._cb_closed_func = cbf
                self.onLayoutFinish.append(self._layoutFinished)
 
@@ -584,8 +585,9 @@ class HbbTVWindow(Screen, InfoBarNotifications):
 
        def _layoutFinished(self):
                command_util = getCommandUtil()
 
        def _layoutFinished(self):
                command_util = getCommandUtil()
+               profile = self._profile
                (sid, onid, tsid, name, orgid) = getChannelInfos()
                (sid, onid, tsid, name, orgid) = getChannelInfos()
-               params  = struct.pack('!IIIII', orgid, sid, onid, tsid, len(name)) + name
+               params  = struct.pack('!IIIIII', orgid, profile, sid, onid, tsid, len(name)) + name
                if self._use_ait:
                        command_util.sendCommand('OP_HBBTV_UNLOAD_AIT')
                        time.sleep(1)
                if self._use_ait:
                        command_util.sendCommand('OP_HBBTV_UNLOAD_AIT')
                        time.sleep(1)
@@ -648,6 +650,7 @@ class HbbTVHelper(Screen):
                self._timer_infobar.start(1000)
 
                self._excuted_browser = False
                self._timer_infobar.start(1000)
 
                self._excuted_browser = False
+               self._profile = 0
 
                __gval__.command_util = BrowserCommandUtil()
 
 
                __gval__.command_util = BrowserCommandUtil()
 
@@ -706,13 +709,15 @@ class HbbTVHelper(Screen):
                        return
 
                use_ait = False
                        return
 
                use_ait = False
+
                for x in self._urls:
                        control_code = x[0]
                        tmp_url = x[2]
                        if tmp_url == url and control_code == 1:
                                use_ait = True
                for x in self._urls:
                        control_code = x[0]
                        tmp_url = x[2]
                        if tmp_url == url and control_code == 1:
                                use_ait = True
+
                self._excuted_browser = True
                self._excuted_browser = True
-               self._session.open(HbbTVWindow, url, self._cb_closed_browser, use_ait)
+               self._session.open(HbbTVWindow, url, self._cb_closed_browser, use_ait, self._profile)
 
        def _cb_closed_browser(self):
                self._excuted_browser = False
 
        def _cb_closed_browser(self):
                self._excuted_browser = False
@@ -729,20 +734,22 @@ class HbbTVHelper(Screen):
                except: pass
 
        def getStartHbbTVUrl(self):
                except: pass
 
        def getStartHbbTVUrl(self):
-               url, self._urls = None, None
+               url, self._urls, self._profile = None, None, 0
                 service = self._session.nav.getCurrentService()
                 info = service and service.info()
                 if not info: return None
                 self._urls = info.getInfoObject(iServiceInformation.sHBBTVUrl)
                for u in self._urls:
                 service = self._session.nav.getCurrentService()
                 info = service and service.info()
                 if not info: return None
                 self._urls = info.getInfoObject(iServiceInformation.sHBBTVUrl)
                for u in self._urls:
-                       if u[0] == 1: # 0:control code, 1:name, 2:url, 3:orgid, 4:appid
+                       if u[0] in (1, -1): # 0:control code, 1:name, 2:url, 3:orgid, 4:appid, 5:profile code
                                url = u[2]
                                url = u[2]
+                               self._profile = u[5]
                if url is None:
                        url = info.getInfoString(iServiceInformation.sHBBTVUrl)
                return url
 
        def showApplicationSelectionBox(self):
                applications = []
                if url is None:
                        url = info.getInfoString(iServiceInformation.sHBBTVUrl)
                return url
 
        def showApplicationSelectionBox(self):
                applications = []
+
                if self.getStartHbbTVUrl():
                        for x in self._urls:
                                applications.append((x[1], x))
                if self.getStartHbbTVUrl():
                        for x in self._urls:
                                applications.append((x[1], x))
index 445551d..3ef0880 100755 (executable)
@@ -1871,7 +1871,7 @@ class InfoBarRedButton:
                try:
                        for x in info.getInfoObject(iServiceInformation.sHBBTVUrl):
                                print x
                try:
                        for x in info.getInfoObject(iServiceInformation.sHBBTVUrl):
                                print x
-                               if x[0] == 1:
+                               if x[0] in (-1, 1):
                                        self.updateAIT(x[3])
                                        self["HbbtvApplication"].setApplicationName(x[1])
                                        break
                                        self.updateAIT(x[3])
                                        self["HbbtvApplication"].setApplicationName(x[1])
                                        break