Changeset 439 in tmcsimulator for trunk/webapps/unifiedlogger/cms_watcher.py
- Timestamp:
- 07/11/2019 02:45:25 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/webapps/unifiedlogger/cms_watcher.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/unifiedlogger/cms_watcher.py
r433 r439 8 8 prevList = [] # previous messages 9 9 currList = [] # current messages 10 locationMap = {} 10 locationMap = {} # map of CMS ID's to locations 11 11 12 12 # Utility functions … … 18 18 # Read the cms message file 19 19 def readFile(): 20 with open (" ../dynamicdata/cms_messages.json",'r') as myfile:20 with open ("webapps/dynamicdata/cms_messages.json",'r') as myfile: 21 21 jsonData=myfile.read() 22 22 … … 25 25 # Read the static file of cms locations and create a lookup map 26 26 def loadLocations(): 27 with open (" ../cptms/data_layers/cms_locations_D12.gjson",'r') as myfile:27 with open ("webapps/cptms/data_layers/cms_locations_D12.gjson",'r') as myfile: 28 28 jsonData=myfile.read() 29 29 … … 40 40 for idx in range(0,len(msgList)): 41 41 idList.append(msgList[idx]['cms']['index']) 42 prevList.append(" ,,,,,")42 prevList.append(":::::") 43 43 return msgList 44 44 … … 49 49 for idx in range(0,len(msgList)): 50 50 currList.append( 51 msgList[idx]['cms']['message']['phase1']['Line1'] + ' ,' +52 msgList[idx]['cms']['message']['phase1']['Line2'] + ' ,' +53 msgList[idx]['cms']['message']['phase1']['Line3'] + ' ,' +54 msgList[idx]['cms']['message']['phase2']['Line1'] + ' ,' +55 msgList[idx]['cms']['message']['phase2']['Line2'] + ' ,' +51 msgList[idx]['cms']['message']['phase1']['Line1'] + ':' + 52 msgList[idx]['cms']['message']['phase1']['Line2'] + ':' + 53 msgList[idx]['cms']['message']['phase1']['Line3'] + ':' + 54 msgList[idx]['cms']['message']['phase2']['Line1'] + ':' + 55 msgList[idx]['cms']['message']['phase2']['Line2'] + ':' + 56 56 msgList[idx]['cms']['message']['phase2']['Line3']) 57 57 … … 71 71 # Is a new message activated? 72 72 if isEmpty(prevList[idx]) and isFull(currList[idx]): 73 results.append("CMS Activated. " + locationMap[idList[idx]] + "'" + currList[idx] +"'")73 results.append("CMS Activated.," + locationMap[idList[idx]] + ", '" + currList[idx] +"'") 74 74 # Is an existing message turned off? 75 75 if isEmpty(currList[idx]) and isFull(prevList[idx]): 76 results.append("CMS Deactivated. " + locationMap[idList[idx]])76 results.append("CMS Deactivated., " + locationMap[idList[idx]]) 77 77 # Did a message change? 78 78 if isFull(currList[idx]) and isFull(prevList[idx]) and currList[idx] != prevList[idx]: 79 results.append("CMS Updated. " + locationMap[idList[idx]] + "'" + currList[idx] +"'")79 results.append("CMS Updated., " + locationMap[idList[idx]] + ", '" + currList[idx] +"'") 80 80 81 81 # Save the current list as previous … … 83 83 return results 84 84 85 # Local main for unit testing 85 86 def main(): 86 87 global currList
Note: See TracChangeset
for help on using the changeset viewer.
