From 8b2bfab8b2619d4d9704fd0aa8812d447e932bc3 Mon Sep 17 00:00:00 2001 From: Tim Essig Date: Mon, 1 Aug 2016 18:43:58 +0200 Subject: [PATCH] Add ric prefixes to notifyMyAndroid-Plugin Allow rics in nma.csv to be defined as prefixes --- plugins/notifyMyAndroid/notifyMyAndroid.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/plugins/notifyMyAndroid/notifyMyAndroid.py b/plugins/notifyMyAndroid/notifyMyAndroid.py index 02d52c2..c812c6a 100644 --- a/plugins/notifyMyAndroid/notifyMyAndroid.py +++ b/plugins/notifyMyAndroid/notifyMyAndroid.py @@ -281,6 +281,25 @@ def run(typ,freq,data): except KeyError: # nothing found pass + # 3. lets look for ric prefixes in pocAPIKeyList + for prefixLength in reversed(range(6)): + ricPrefix = data['ric'][:prefixLength] + #fill the ric with stars + ricPrefix = ricPrefix.ljust(8,'*') + try: + xID = ricPrefix + # data structure: pocAPIKeyList[xID][i] = (xAPIKey, xPriority, xEventPrefix) + for i in range(len(pocAPIKeyList[xID])): + xEvent = event + (xAPIKey, xPriority, xEventPrefix) = pocAPIKeyList[xID][i] + if len(xEventPrefix) > 0: + xEvent = xEventPrefix + ": " + xEvent + response = nma.pushWithAPIKey(xAPIKey, application, xEvent, msg, priority=xPriority) + checkResponse(response, xAPIKey) + except KeyError: + # nothing found + pass + # end if "POC" in typ # end if usecsv == True except: