author | Ting Wang <ting.wang@amlogic.com> | 2017-11-27 07:27:05 (GMT) |
---|---|---|
committer | Ting Wang <ting.wang@amlogic.com> | 2017-12-05 06:15:14 (GMT) |
commit | 3cc4b795cfe05d49f673104866cebad125ae1b68 (patch) | |
tree | a043e2f555ce7819e3c0ec3a475d495fb49958c6 | |
parent | 213f8c722b8a3ee6039bb0fcd3181d87ffbc17a6 (diff) | |
download | tv-3cc4b795cfe05d49f673104866cebad125ae1b68.zip tv-3cc4b795cfe05d49f673104866cebad125ae1b68.tar.gz tv-3cc4b795cfe05d49f673104866cebad125ae1b68.tar.bz2 |
LiveTv:add text display for eas[2/2]
PD# 155571
add text display for eas when the priority is
less
Change-Id: I76e49f1151e96f881de080f2dc90805580543f33
-rw-r--r-- | core/java/com/droidlogic/app/tv/EasEvent.java | 53 | ||||
-rw-r--r-- | core/java/com/droidlogic/app/tv/EasManager.java | 41 | ||||
-rw-r--r-- | core/java/com/droidlogic/app/tv/TvControlManager.java | 11 |
3 files changed, 78 insertions, 27 deletions
diff --git a/core/java/com/droidlogic/app/tv/EasEvent.java b/core/java/com/droidlogic/app/tv/EasEvent.java index c438ac3..e32d140 100644 --- a/core/java/com/droidlogic/app/tv/EasEvent.java +++ b/core/java/com/droidlogic/app/tv/EasEvent.java @@ -5,11 +5,6 @@ import android.util.Log; public class EasEvent { private static final String TAG = "EasEvent"; - private static final long GPS_UTC_OFFSET_IN_SECONDS = 315964800; - private static final int EAS_TEXT_MESSAGE = 0; - private static final int EAS_LOW_PRIORITY = 3; - private static final int EAS_MEDIUM_PRIORITY = 7; - private static final int EAS_HIGH_PRIORITY = 11; public int tableId; //table id public int extension; //subtable id public int version; //version_number @@ -62,6 +57,14 @@ public class EasEvent { public int[] data; //content } + public void printEasEventInfo(){ + Log.i(TAG,"[EasEventInfo]"+ + "\n alertMessageTimeRemaining = "+alertMessageTimeRemaining+ + "\n alertPriority = "+alertPriority+ + "\n detailsMajorChannelNumber = "+detailsMajorChannelNumber+ + "\n detailsMinorChannelNumber = "+detailsMinorChannelNumber); + } + public void readEasEvent(Parcel p) { Log.i(TAG,"readEasEvent"); int i, j, k; @@ -76,10 +79,10 @@ public class EasEvent { for (j=0;j<3;j++) { easOrigCode[j] = p.readInt(); } - int scnt = p.readInt(); - if (scnt != 0) { - easEventCode = new int[scnt]; - for (j=0;j<scnt;j++) + easEventCodeLen = p.readInt(); + if (easEventCodeLen != 0) { + easEventCode = new int[easEventCodeLen]; + for (j=0;j<easEventCodeLen;j++) easEventCode[j] = p.readInt(); } alertMessageTimeRemaining = p.readInt(); @@ -90,20 +93,20 @@ public class EasEvent { detailsMajorChannelNumber = p.readInt(); detailsMinorChannelNumber = p.readInt(); audioOOBSourceID = p.readInt(); - scnt = p.readInt(); - if (scnt != 0) { - location = new Location[scnt]; - for (j=0;j<scnt;j++) { + locationCount = p.readInt(); + if (locationCount != 0) { + location = new Location[locationCount]; + for (j=0;j<locationCount;j++) { location[j] = new Location(); location[j].stateCode = p.readInt(); location[j].countySubdiv = p.readInt(); location[j].countyCode = p.readInt(); } } - scnt = p.readInt(); - if (scnt != 0) { - exceptionList = new ExceptionList[scnt]; - for (j=0;j<scnt;j++) { + exceptionCount = p.readInt(); + if (exceptionCount != 0) { + exceptionList = new ExceptionList[exceptionCount]; + for (j=0;j<exceptionCount;j++) { exceptionList[j] = new ExceptionList(); exceptionList[j].inBandRefer = p.readInt(); exceptionList[j].exceptionMajorChannelNumber = p.readInt(); @@ -111,10 +114,10 @@ public class EasEvent { exceptionList[j].exceptionOOBSourceID = p.readInt(); } } - scnt = p.readInt(); - if (scnt != 0) { - multiText = new MultiStr[scnt]; - for (j=0;j<scnt;j++) { + multiTextCount = p.readInt(); + if (multiTextCount != 0) { + multiText = new MultiStr[multiTextCount]; + for (j=0;j<multiTextCount;j++) { multiText[j] = new MultiStr(); multiText[j].lang = new int[3]; multiText[j].lang[0] = p.readInt(); @@ -130,10 +133,10 @@ public class EasEvent { } } } - scnt = p.readInt(); - if (scnt != 0) { - descriptor = new Descriptor[scnt]; - for (j=0;j<scnt;j++) { + descriptorTextCount = p.readInt(); + if (descriptorTextCount != 0) { + descriptor = new Descriptor[descriptorTextCount]; + for (j=0;j<descriptorTextCount;j++) { descriptor[j] = new Descriptor(); descriptor[j].tag = p.readInt(); descriptor[j].length = p.readInt(); diff --git a/core/java/com/droidlogic/app/tv/EasManager.java b/core/java/com/droidlogic/app/tv/EasManager.java new file mode 100644 index 0000000..37c9b36 --- a/dev/null +++ b/core/java/com/droidlogic/app/tv/EasManager.java @@ -0,0 +1,41 @@ +package com.droidlogic.app.tv; + +import android.os.Parcel; +import android.util.Log; + +public class EasManager { + private static final String TAG = "EasManager"; + private static final long GPS_UTC_OFFSET_IN_SECONDS = 315964800; + private static final int EAS_TEXT_MESSAGE = 0; + private static final int EAS_LOW_PRIORITY = 4; + private static final int EAS_MEDIUM_PRIORITY = 8; + private static final int EAS_HIGH_PRIORITY = 12; + + private EasEvent preEasEvent = null; + private EasEvent curEasEvent = null; + + public boolean isEasEventNeedProcess(EasEvent easEvent) { + Log.i(TAG,"isEasEventNeedProcess"); + curEasEvent = easEvent; + easEvent.printEasEventInfo(); + if (easEvent.protocolVersion != 0) { + return false; + } + + if (easEvent.alertPriority == 0) { + return false; + } + + preEasEvent = easEvent; + return true; + } + + public boolean isEasEventNeedChannel(){ + if (curEasEvent != null && curEasEvent.alertPriority >= EAS_HIGH_PRIORITY) { + return true; + }else { + return false; + } + } + } + diff --git a/core/java/com/droidlogic/app/tv/TvControlManager.java b/core/java/com/droidlogic/app/tv/TvControlManager.java index dfb0aa1..13cd4b1 100644 --- a/core/java/com/droidlogic/app/tv/TvControlManager.java +++ b/core/java/com/droidlogic/app/tv/TvControlManager.java @@ -127,6 +127,7 @@ public class TvControlManager { public static int EVENT_RRT_SCAN_START = 1; public static int EVENT_RRT_SCAN_END = 3; + private EasManager easManager = new EasManager(); private static TvControlManager mInstance; private native final void native_setup(Object tv_this); @@ -563,7 +564,13 @@ public class TvControlManager { for (int count = 0; count<sectionCount; count++) { EasEvent curEasEvent = new EasEvent(); curEasEvent.readEasEvent(p); - mEasListener.processDetailsChannelAlert(curEasEvent); + if (easManager.isEasEventNeedProcess(curEasEvent)) { + if (easManager.isEasEventNeedChannel()) { + mEasListener.processDetailsChannelAlert(curEasEvent); + }else { + mEasListener.processTextAlert(curEasEvent); + } + } } } @@ -4782,8 +4789,8 @@ public class TvControlManager { mEasListener = l; } public interface EasEventListener { - HashMap<String,Integer> getCurChannelNumber(); void processDetailsChannelAlert(EasEvent ev); + void processTextAlert(EasEvent ev); } public class VFrameEvent{ |