diff --git a/Students/Dave Fugelso/Project/Alpine/TestHarness.py b/Students/Dave Fugelso/Project/Alpine/TestHarness.py new file mode 100644 index 00000000..b6b18cf3 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/TestHarness.py @@ -0,0 +1,262 @@ +# +# TestHarness.py +# Copyright (c) 2014 Airbiquity +# +# The tester emulates the body of requests coming over the network interface +# + +import sys +import threading +import json +import time +import Templates +import FileCache +import logger + +# Remove this import if non interface to Alpine +import HupInterface + +msglogger = logger.Logger() + + +''' +The following are test for the Template interface +''' + +def testTemplate1 (filename): + #print 'template1 file: ' + filename + #msglogger.logMessage(logger.DEBUG, 'testTemplate1', filename) + try: + with open(filename) as tmp1_file: + t = Templates.Template1 () + t.HandleRequest (tmp1_file.read()) + #print json.dumps(tmp1_file, indent=2) + except IOError as e: + print 'File read error' # TBD goes to error handler + +def testTemplate2 (filename): + try: + with open(filename) as tmp1_file: + t = Templates.Template2 () + t.HandleRequest (tmp1_file.read()) + #print json.dumps(tmp1_file, indent=2) + except IOError as e: + print 'File read error' # TBD goes to error handler + +def testTemplate3 (filename): + try: + with open(filename) as tmp1_file: + t = Templates.Template3 () + t.HandleRequest (tmp1_file.read()) + #print json.dumps(tmp1_file, indent=2) + except IOError as e: + print 'File read error' # TBD goes to error handler + +def testTemplate4 (filename): + try: + with open(filename) as tmp1_file: + t = Templates.Template4 () + t.HandleRequest (tmp1_file.read()) + #print json.dumps(tmp1_file, indent=2) + except IOError as e: + print 'File read error' # TBD goes to error handler + +def testTemplate5 (filename): + try: + with open(filename) as tmp1_file: + t = Templates.Template5 () + t.HandleRequest (tmp1_file.read()) + #print json.dumps(tmp1_file, indent=2) + except IOError as e: + print 'File read error' # TBD goes to error handler + +def testTemplate6 (filename): + try: + with open(filename) as tmp1_file: + t = Templates.Template6 () + t.HandleRequest (tmp1_file.read()) + #print json.dumps(tmp1_file, indent=2) + except IOError as e: + print 'File read error' # TBD goes to error handler + +def testTemplate7 (filename): + try: + with open(filename) as tmp1_file: + t = Templates.Template7 () + t.HandleRequest (tmp1_file.read()) + #print json.dumps(tmp1_file, indent=2) + except IOError as e: + print 'File read error' # TBD goes to error handler + +def testTemplate8 (filename): + try: + with open(filename) as tmp1_file: + t = Templates.Template8 () + t.HandleRequest (tmp1_file.read()) + #print json.dumps(tmp1_file, indent=2) + except IOError as e: + print 'File read error' # TBD goes to error handler + + +def testApplicationList(filename): + try: + with open(filename) as tmp1_file: + t = Templates.SendApplicationInformation() + t.HandleRequest (tmp1_file.read()) + #print json.dumps(tmp1_file, indent=2) + except IOError as e: + print 'File read error' # TBD goes to error handler + +def testNowExecuting(filename): + try: + with open(filename) as tmp1_file: + t = Templates.RequestNowExecutingInfomation() + t.HandleRequest(tmp1_file.read()) + except IOError as e: + print 'File read error nowExecuting.json' + +def testRequestAudioFocus(filename): + try: + with open(filename) as tmp1_file: + t = Templates.RequestAudioFocusInformation() + t.HandleRequest(tmp1_file.read()) + except IOError as e: + print 'File read error requestAudioFocus.json' + +def testSetLocation(filename): + try: + with open(filename) as tmp1_file: + t = Templates.RequestSetLocationInformation() + t.HandleRequest(tmp1_file.read()) + except IOError as e: + print 'File read error setlocation.json' + +def testPhoneIsAvailable(filename): + try: + with open(filename) as tmp1_file: + t = Templates.RequestSetPhoneAvailabilityInformation() + t.HandleRequest(tmp1_file.read()) + except IOError as e: + print 'File read error setPhoneAvailability.json' + +def testGoToKeyboard(): + t = Templates.RequestRequestGoToKeyboard() + t.HandleRequest() + +def startMIPApp (): + dictionary = dict() + dict['appType'] = 1 + dict['appName'] = 'Pandora' + # Create event broker with path '/hap/api/1.0/StartApplication' + # and json code json.dumps(dict) + + + +# Removed Native Platform Testing for TestHarness for template testers. Creating separate +# Native Platform Test Harness. + + +def starttest(testfilepath): + + msglogger.logMessage(logger.DEBUG, 'starttest', 'start') + + + #print 'Make a connection' + #MakeAConnection() + #time.sleep(5) + #print 'Done with connection' + + # print 'test NowExecuting' + # testNowExecuting(testfilepath + 'nowExecuting.json') + # print 'test RequestAudioFocus' + # testRequestAudioFocus(testfilepath + 'requestAudioFocus.json') + # print 'test setLocation' + # testSetLocation(testfilepath + 'setlocation.json') + # print 'test PhoneIsAvailable' + # testPhoneIsAvailable(testfilepath + 'setPhoneAvailability.json') + # print 'test GoToKeyboard' + # testGoToKeyboard() + # time.sleep(2) + + + testTemplate1( testfilepath + 'template1A.json' ) + print 'testTemplate1A done.' + time.sleep(2) + + # testTemplate1( testfilepath + 'template1A2.json' ) + # print 'testTemplate1A2 done.' + # time.sleep (3) + + # testTemplate1( testfilepath + 'template1A3.json' ) + # print 'testTemplate1A3 done.' + # time.sleep(2) + + # testTemplate1( testfilepath + 'template1B.json' ) + # print 'testTemplate1B done.' + # time.sleep(2) + + # testTemplate2(testfilepath + 'template2A.json') + # print 'testTemplate2A done.' + # time.sleep(2) + + # testTemplate2(testfilepath + 'template2B.json') + # print 'testTemplate2B done.' + # time.sleep(2) + + # testTemplate3(testfilepath + 'template3A.json') + # print 'testTemplate3A done.' + # time.sleep(2) + + # testTemplate3(testfilepath + 'template3B.json') + # print 'testTemplate3B done.' + # time.sleep(2) + + # testTemplate4(testfilepath + 'template4A.json') + # print 'testTemplate4A done.' + # time.sleep(2) + + # testTemplate4(testfilepath + 'template4B.json') + # print 'testTemplate4B done.' + # time.sleep(2) + + # testTemplate5(testfilepath + 'template5.json') + # print 'testTemplate5 done.' + # time.sleep(2) + + # testTemplate6(testfilepath + 'template6.json') + # print 'testTemplate6 done.' + # time.sleep(2) + + # testTemplate7(testfilepath + 'template7.json') + # print 'testTemplate7 done.' + # time.sleep(2) + + # testTemplate8(testfilepath + 'template8A.json') + # print 'testTemplate8A done.' + # time.sleep(2) + + # testTemplate8(testfilepath + 'template8B.json') + # print 'testTemplate8B done.' + # time.sleep(2) + + # testApplicationList(testfilepath + 'applications.json') + + #uncomment following to run an infinite loop to test incoming messages + # otherwise execution will end at the end of this script. + while (True): + time.sleep(1) + + + print 'Okay we\'re done.' + HupInterface.stopHupInterface() + + print 'call exit' + exit() + + +''' +Run tests as needed. Modify json files in testfiles to get different behaviors on tempaltes. +''' +if __name__ == "__main__": + HupInterface.startHupInterface() + starttest('testfiles/') diff --git a/Students/Dave Fugelso/Project/Alpine/build/Common/PrintData.o b/Students/Dave Fugelso/Project/Alpine/build/Common/PrintData.o new file mode 100644 index 00000000..d52e976d Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/build/Common/PrintData.o differ diff --git a/Students/Dave Fugelso/Project/Alpine/build/Common/Serialize_UnSerialize.o b/Students/Dave Fugelso/Project/Alpine/build/Common/Serialize_UnSerialize.o new file mode 100644 index 00000000..1b97306d Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/build/Common/Serialize_UnSerialize.o differ diff --git a/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/ABQHUPWrapperInterface.o b/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/ABQHUPWrapperInterface.o new file mode 100644 index 00000000..ac8308ae Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/ABQHUPWrapperInterface.o differ diff --git a/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/ABQNativeInterface.o b/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/ABQNativeInterface.o new file mode 100644 index 00000000..945716b1 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/ABQNativeInterface.o differ diff --git a/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/HupInterface.o b/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/HupInterface.o new file mode 100644 index 00000000..565db574 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/HupInterface.o differ diff --git a/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/apn_abq_API.o b/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/apn_abq_API.o new file mode 100644 index 00000000..564cd95c Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/build/temp.linux-x86_64-2.7/apn_abq_API.o differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/100x100A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/100x100A.png new file mode 100644 index 00000000..e12f4fed Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/100x100A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/100x100B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/100x100B.png new file mode 100644 index 00000000..c005abb0 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/100x100B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/100x100C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/100x100C.png new file mode 100644 index 00000000..15ea8a89 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/100x100C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/100x100D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/100x100D.png new file mode 100644 index 00000000..d6f4f507 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/100x100D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/120x64A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/120x64A.png new file mode 100644 index 00000000..968c4ce2 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/120x64A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/120x64B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/120x64B.png new file mode 100644 index 00000000..f8fdb9b8 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/120x64B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/120x64C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/120x64C.png new file mode 100644 index 00000000..03deeafb Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/120x64C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/135x30A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30A.png new file mode 100644 index 00000000..8ff8757a Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/135x30B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30B.png new file mode 100644 index 00000000..01df8d73 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/135x30C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30C.png new file mode 100644 index 00000000..4a55966e Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/135x30D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30D.png new file mode 100644 index 00000000..0dda84ad Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/135x30E.png b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30E.png new file mode 100644 index 00000000..22ab90a1 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/135x30E.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x60A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60A.png new file mode 100644 index 00000000..8671039b Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x60B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60B.png new file mode 100644 index 00000000..c6c41697 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x60C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60C.png new file mode 100644 index 00000000..43b6a49f Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x60D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60D.png new file mode 100644 index 00000000..99a5256f Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x60E.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60E.png new file mode 100644 index 00000000..6230364b Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60E.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x60F.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60F.png new file mode 100644 index 00000000..2fa6206b Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x60F.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x64A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64A.png new file mode 100644 index 00000000..a5bf1710 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x64B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64B.png new file mode 100644 index 00000000..61843887 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x64C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64C.png new file mode 100644 index 00000000..f13b97ce Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x64D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64D.png new file mode 100644 index 00000000..110e8e08 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x64E.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64E.png new file mode 100644 index 00000000..1ba4e5d9 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64E.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x64F.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64F.png new file mode 100644 index 00000000..1ce75f5b Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64F.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x64G.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64G.png new file mode 100644 index 00000000..21dc63fd Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64G.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x64H.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64H.png new file mode 100644 index 00000000..59855416 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64H.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/140x64I.png b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64I.png new file mode 100644 index 00000000..c56b7381 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/140x64I.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/200x150A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/200x150A.png new file mode 100644 index 00000000..50c6aefc Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/200x150A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/200x150B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/200x150B.png new file mode 100644 index 00000000..d7f8e79d Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/200x150B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/200x150C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/200x150C.png new file mode 100644 index 00000000..330701bc Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/200x150C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/250x22A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/250x22A.png new file mode 100644 index 00000000..1a92896a Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/250x22A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/250x22B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/250x22B.png new file mode 100644 index 00000000..f1fc7357 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/250x22B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/250x22C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/250x22C.png new file mode 100644 index 00000000..3a80802d Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/250x22C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/250x22D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/250x22D.png new file mode 100644 index 00000000..5e2b64cc Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/250x22D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/250x45A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/250x45A.png new file mode 100644 index 00000000..0e7be45a Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/250x45A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/250x45B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/250x45B.png new file mode 100644 index 00000000..e2cc3ee3 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/250x45B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/25x25A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25A.png new file mode 100644 index 00000000..1f00352e Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/25x25B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25B.png new file mode 100644 index 00000000..04affc76 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/25x25C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25C.png new file mode 100644 index 00000000..48db1f63 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/25x25D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25D.png new file mode 100644 index 00000000..b589ede7 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/25x25E.png b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25E.png new file mode 100644 index 00000000..3e58c781 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/25x25E.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/28x28A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28A.png new file mode 100644 index 00000000..94366085 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/28x28B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28B.png new file mode 100644 index 00000000..c093ec31 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/28x28C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28C.png new file mode 100644 index 00000000..52395a05 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/28x28D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28D.png new file mode 100644 index 00000000..0d6bbbde Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/28x28E.png b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28E.png new file mode 100644 index 00000000..166e2fd7 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/28x28E.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/378x22A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/378x22A.png new file mode 100644 index 00000000..b21687d9 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/378x22A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/378x22B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/378x22B.png new file mode 100644 index 00000000..7361c11e Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/378x22B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/378x22C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/378x22C.png new file mode 100644 index 00000000..3bdd796f Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/378x22C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/378x22D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/378x22D.png new file mode 100644 index 00000000..1d5cdb35 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/378x22D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/478x185A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/478x185A.png new file mode 100644 index 00000000..1c1fe22e Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/478x185A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/478x233A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/478x233A.png new file mode 100644 index 00000000..d8267e8d Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/478x233A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/500x8A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/500x8A.png new file mode 100644 index 00000000..989578d2 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/500x8A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/500x8B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/500x8B.png new file mode 100644 index 00000000..d644d460 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/500x8B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/500x8C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/500x8C.png new file mode 100644 index 00000000..7a695c7f Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/500x8C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/56x64A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/56x64A.png new file mode 100644 index 00000000..49eeebf8 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/56x64A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/56x64B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/56x64B.png new file mode 100644 index 00000000..1ac37a17 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/56x64B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/76x60A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60A.png new file mode 100644 index 00000000..e222126c Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/76x60B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60B.png new file mode 100644 index 00000000..3bb2480e Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/76x60C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60C.png new file mode 100644 index 00000000..74262717 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/76x60D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60D.png new file mode 100644 index 00000000..afa4c98c Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/76x60E.png b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60E.png new file mode 100644 index 00000000..f7e03178 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60E.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/76x60F.png b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60F.png new file mode 100644 index 00000000..ac3bab37 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/76x60F.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/80x64A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64A.png new file mode 100644 index 00000000..34142782 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/80x64B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64B.png new file mode 100644 index 00000000..95d8ecee Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/80x64C.png b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64C.png new file mode 100644 index 00000000..0d64c945 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64C.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/80x64D.png b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64D.png new file mode 100644 index 00000000..2262164a Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64D.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/80x64E.png b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64E.png new file mode 100644 index 00000000..ded2ec2a Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64E.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/80x64F.png b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64F.png new file mode 100644 index 00000000..ffba52cd Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/80x64F.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/80x80A.png b/Students/Dave Fugelso/Project/Alpine/testfiles/80x80A.png new file mode 100644 index 00000000..b5a2e7fa Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/80x80A.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/80x80B.png b/Students/Dave Fugelso/Project/Alpine/testfiles/80x80B.png new file mode 100644 index 00000000..b5924159 Binary files /dev/null and b/Students/Dave Fugelso/Project/Alpine/testfiles/80x80B.png differ diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/HUinfo.json b/Students/Dave Fugelso/Project/Alpine/testfiles/HUinfo.json new file mode 100644 index 00000000..2e721270 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/HUinfo.json @@ -0,0 +1,15 @@ +{ + "headUnitSerialNumber": "", + "vehicleModel": "", + "distance" : <"mi" | "km">, + "time": <"12" | "24">, + "date": <"MMDDYY" | "DDMMYY">, + "Temperature": <"C" | "F"> + "versioninfo": [ + { + "" : ", + "" : <1 | 0> + } + ] +} \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/HupWrapper.py b/Students/Dave Fugelso/Project/Alpine/testfiles/HupWrapper.py new file mode 100644 index 00000000..a2d35f85 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/HupWrapper.py @@ -0,0 +1,50 @@ + +#//////////////////////////////////////////////////////////////////////////////////////////////////// +# Image Request + +# This expects the body to contain the appId and a path of a locally stored image file +class AlpineFetchImageResponseHandler(ResponseHandler): + def response(self, responseCode, headers, mimeType, body): + print 'have image for : ' + headers + try: + d = json.loads(body) + if (d.has_key('path') and d.has_key('appId'): + #TBD: Check if appId is still current appId + SendImage (d['path'], d['appId']) + else: + print 'Bad format for SendImage' + except: + print 'bad json into response handler for image request' + + +def imageRequest (d): + eb.request('GET','/RequestImage/', None, json.dumps(d),'application/json',[], AlpineFetchImageResponseHandler()) + + + +# This will be replaced by Configurator! +def RegisterHandlers (eb): + # Except these. These are not MIP callback handlers + HupInterface.requestCallback('RequestImage', imageRequest) + imageHandler = + + +#//////////////////////////////////////////////////////////////////////////////////////////////////// +# Register callbacks for Alpine initiated request + def setup(): + global srv, eb, myHandler + + + #handler1 = AlpineRequestHandler('HeadUnitID', RequestHeadUnitID) + #handler3 = AlpineRequestHandler('SetTemplate1', template1) + myHandler = MyResponseHandler() + + + # HttpGatewayRequestHandler is currently stubbed out and will be fixed by Jack Friday morning. + handler2 = HttpGatewayRequestHandler(btMCSSF, host=address_to_handset, port=port_of_handset_server) + + # Template 1 handler + + eb = EventBroker() + + RegisterHandlers (eb) \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/alpine.json b/Students/Dave Fugelso/Project/Alpine/testfiles/alpine.json new file mode 100644 index 00000000..c545c1c8 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/alpine.json @@ -0,0 +1,514 @@ + +//////////////////////////////////////////////////////////////////////////////// +// These are responses HUP to HAP + + + + +{ + "path": "/hap/api/1.0/VehicleMakeAndModel", + "Make": "", + "Model": "" +} + +{ + "path": "/hap/api/1.0/MipSlipConnection", + "Status": "11111111", + "IP Address": " +} + +{ + "path": "/hap/api/1.0/DayNightMode", + "Mode": <"Day" | "Night"> +} + +{ + "path": "/hap/api/1.0/VehicleSpeed", + "Speed": +} + +{ + "path": "/hap/api/1.0/VehicleLocation", + "Direction": < + "latitude": , + "longitude": " +} + +{ + "path": "/hap/api/1.0/DestinationLocation", + "Destination": "Valid", + "latitude": , + "longitude": " +} + +{ + "path": "/hap/api/1.0/Shutdown" +} + +{ + "path": "/hap/api/1.0/MeasurementUnitDispFormat", + "Distance Unit": "M", + "Time Display": "12", + "Date Format": "MMDDYY", + "Temperature": "C" +} + +//////////////////////////////////////////////////////////////////////////////// +// These are requests Hap to HUP for the Native interface + +{ + "path": "/hup/api/1.0/RequestMipSlipConnectionStatus" +} + +{ + "path": "/hup/api/1.0/RequestHeadUnitID" +} + +{ + "path": "/hup/api/1.0/RequestVehicleMakeAndModel" +} + +{ + "path": "/hup/api/1.0/RequestHeadunitLanguageSetting" +} + +{ + "path": "/hup/api/1.0/RequestMeasurementUnitsAndDisplayFormat" +} + +{ + "path": "/hup/api/1.0/RequestMeasurementUnitsAndDisplayFormat" +} + +{ + "path": "/hup/api/1.0/RequestVehicleLocation" +} + +{ + "path": "/hup/api/1.0/RequestDestinationLocation" +} + +{ + "path": "/hup/api/1.0/RequestDayNightMode" +} + +{ + "path": "/hup/api/1.0/RequestVehicleSpeed" +} + +///////////////////////////////////////////////////// +// HAP to HUP Template messages + +{ + "path": "/hup/api/1.0/ApplicationList", + "Applications" : [ + { + "Name" : "", + "Icon" : , + "Type" : <"Audio" | "POI" | "Social" | "News" | "Sports" | "Stocks" | "Navigation" | "Traffic" | "Fuel" | "Parking" | "SpeedCameras" | "Weather" | "Flights" | "VRTTS" | "Movies"> + "Languages" : [ + { + "Language" : "", + "Local Name" : "" + } + ] + }, + { + + }, + ... + { + + } + ] +} + + +{ + "path": "/hup/api/1.0/NowExecuting", + "Name" : "", + "Type" : <"Audio" | "POI" | "Social" | "News" | "Sports" | "Stocks" | "Navigation" | "Traffic" | "Fuel" | "Parking" | "SpeedCameras" | "Weather" | "Flights" | "VRTTS" | "Movies"> +} + +{ + "path": "/hup/api/1.0/RequestAudioFocus", + "SourceType" : "" +} + +{ + "path": "/hup/api/1.0/ReleaseAudioFocus" +} + +{ + "path": "/hup/api/1.0/SetPhoneAvailability", + "Available" : " +} + +{ + "path": "/hup/api/1.0/SetLocation", + "Latitude" : , + "Longitude" : , + "Type" : <"None" | "Waypoint" | "Destination" | "POI"> + "PointInformation" : { + "Address" : "", + "Street" : "" + "HouseNumber" : "", + "PostalCode;" : "", + "City" : "", + "State" : "", + "Country" : "", + "Phone" : "", + "AdditionalInfo" : "" + } +} + +{ + "path": "/hup/api/1.0/Image", + "ImageID" : , + "Cache" : , + "Name" : , + TBD - details of transfer +} + +{ + "path": "/hup/api/1.0/Template1", + "partialUpdate" : <1 | 0>, + "appID" : "", + "screenID" : , + "loadingType" : < 1 | 2 | 3 | 4>, // < "ShowLoadScreen" | "ShowText" | "DoNotShowLoadScreen" | "LoadKeyboard"> + "backgroundImage" : , + "systemHeader" : <1 | 0>, + "templateContent" : { + "title" : { + "image" : , + "text" : "" + }, + "img01" : <image id>, + "img02" : <image id>, + "buttons" : { + "1": { + "text" : "<optional text>", + "image" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "backgroundImage" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "scrollUpButton" : <1 | 0>, // optional defaults 0 + "scrollDownButton" : <1 | 0>, // optional defaults 0 + "enabled" : <1 | 0> // optional defaults 1 + } + "2" : {..}, + ... + "6" : {..} + }, + "text01" : "<text 01">, + "text02" : "<text 02">, + "text03" : "<text 03">, + "text04" : "<text 04">, + "progress" : { + "color" : <Hex color e.g "#FEFEFE" >, + "totalSeconds" : <total seconds>, + "current" : <0.0 to 1.0>, + "active" : <1 | 0> + } + } +} + +{ + "path": "/hup/api/1.0/Template2", + "partialUpdate" : <1 | 0>, + "appID" : "<application name>", + "screenID" : <screen ID>, + "loadingType" : < 1 | 2 | 3 | 4>, // < "ShowLoadScreen" | "ShowText" | "DoNotShowLoadScreen" | "LoadKeyboard"> + "backgroundImage" : <Image ID this is optional>, + "systemHeader" : <1 | 0>, + "templateContent" : { + "title" : { + "image" : <image id>, + "text" : "<title text>" + }, + "buttons" : { + "1": { + "text" : "<optional text>", + "line02" : "<optional second line for Template 2>", + "image" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "backgroundImage" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "scrollUpButton" : <1 | 0>, // optional defaults 0 + "scrollDownButton" : <1 | 0>, // optional defaults 0 + "enabled" : <1 | 0> // optional defaults 1 + } + "2" : {..}, + ... + "9" : {..} + } + } + +} + +{ + "path": "/hup/api/1.0/Template3", + "partialUpdate" : <1 | 0>, + "appID" : "<application name>", + "screenID" : <screen ID>, + "loadingType" : < 1 | 2 | 3 | 4>, // < "ShowLoadScreen" | "ShowText" | "DoNotShowLoadScreen" | "LoadKeyboard"> + "backgroundImage" : <Image ID this is optional>, + "systemHeader" : <1 | 0>, + "templateContent" : { + "title" : { + "image" : <image id>, + "text" : "<title text>" + }, + + "list" : [ + { + "text" : "<text01 to text05>", + "image" : <imag01 to img05>, + "special" : "<special text"> + }, + { .. up to 5 } + ] + + "buttons" : { + "1": { + "text" : "<optional text>", + "image" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "backgroundImage" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "scrollUpButton" : <1 | 0>, // optional defaults 0 + "scrollDownButton" : <1 | 0>, // optional defaults 0 + "enabled" : <1 | 0> // optional defaults 1 + } + "2" : {..}, + ... + "6" : {..} + } + } + +} + +{ + "path": "/hup/api/1.0/Template4", + "partialUpdate" : <1 | 0>, + "appID" : "<application name>", + "screenID" : <screen ID>, + "loadingType" : < 1 | 2 | 3 | 4>, // < "ShowLoadScreen" | "ShowText" | "DoNotShowLoadScreen" | "LoadKeyboard"> + "backgroundImage" : <Image ID this is optional>, + "systemHeader" : <1 | 0>, + "templateContent" : { + + "text01" : "<text 01">, + "text02" : "<text 02">, + + "buttons" : { + "1": { + "text" : "<text>", + "image" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "backgroundImage" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "scrollUpButton" : <1 | 0>, // optional defaults 0 + "scrollDownButton" : <1 | 0>, // optional defaults 0 + "enabled" : <1 | 0> // optional defaults 1 + } + "2" : {..}, + "3" : {..} + } + } +} + +{ + "path": "/hup/api/1.0/Template5", + "partialUpdate" : <1 | 0>, + "appID" : "<application name>", + "screenID" : <screen ID>, + "loadingType" : < 1 | 2 | 3 | 4>, // < "ShowLoadScreen" | "ShowText" | "DoNotShowLoadScreen" | "LoadKeyboard"> + "backgroundImage" : <Image ID this is optional>, + "systemHeader" : <1 | 0>, + "templateContent" : { + "title" : { + "image" : <image id>, + "text" : "<title text>" + }, + "text01" : "<text 01">, + "buttons" : { + "1": { + "text" : "<optional text>", + "image" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "backgroundImage" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "scrollUpButton" : <1 | 0>, // optional defaults 0 + "scrollDownButton" : <1 | 0>, // optional defaults 0 + "enabled" : <1 | 0> // optional defaults 1 + } + "2" : {..}, + ... + "6" : {..} + } + } + +} + +{ + "path": "/hup/api/1.0/Template6", + "partialUpdate" : <1 | 0>, + "appID" : "<application name>", + "screenID" : <screen ID>, + "loadingType" : < 1 | 2 | 3 | 4>, // < "ShowLoadScreen" | "ShowText" | "DoNotShowLoadScreen" | "LoadKeyboard"> + "backgroundImage" : <Image ID this is optional>, + "systemHeader" : <1 | 0>, + "templateContent" : { + "title" : { + "image" : <image id>, + "text" : "<title text>" + }, + "line02" : { + "text" : "<text>", + "image" : <image id> + } + "img01" : <image id>, + "text01" : "<text 01>", + "text03" : "<text 03>", + "buttons" : { + "1": { + "text" : "<optional text>", + "image" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "backgroundImage" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "scrollUpButton" : <1 | 0>, // optional defaults 0 + "scrollDownButton" : <1 | 0>, // optional defaults 0 + "enabled" : <1 | 0> // optional defaults 1 + } + "2" : {..}, + ... + "6" : {..} + } + } +} + + +{ + "path": "/hup/api/1.0/Template7", + "partialUpdate" : <1 | 0>, + "appID" : "<application name>", + "screenID" : <screen ID>, + "loadingType" : < 1 | 2 | 3 | 4>, // < "ShowLoadScreen" | "ShowText" | "DoNotShowLoadScreen" | "LoadKeyboard"> + "backgroundImage" : <Image ID this is optional>, + "systemHeader" : <1 | 0>, + "templateContent" : { + "title" : { + "image" : <image id>, + "text" : "<title text>" + }, + "line02" : { + "text" : "<text>", + "image" : <image id> + } + "img01" : <image id>, + "text01" : "<text 01">, + "text03" : "<text 03">, + "buttons" : { + "1": { + "text" : "<optional text>", + "image" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "backgroundImage" : { + "normal" : <int image normal optional>, + "pressed" : <int button pressed image optional> + }, + "scrollUpButton" : <1 | 0>, // optional defaults 0 + "scrollDownButton" : <1 | 0>, // optional defaults 0 + "enabled" : <1 | 0> // optional defaults 1 + } + "2" : {..}, + ... + "6" : {..} + } + } +} + +{ + "path": "/hup/api/1.0/Template8", + "partialUpdate" : <1 | 0>, + "appID" : "<application name>", + "screenID" : <screen ID>, + "loadingType" : < 1 | 2 | 3 | 4>, // < "ShowLoadScreen" | "ShowText" | "DoNotShowLoadScreen" | "LoadKeyboard"> + "backgroundImage" : <Image ID this is optional>, + "systemHeader" : <1 | 0>, + "templateContent" : { + "title" : { + "image" : <image id>, + "text" : "<title text>" + }, + "text01" : "<text 01">, + "img01" : <image id>, + "img02" : <image id> + } +} + +{ + "path": "/hap/api/1.0/SetText", + "Text" : "<user input text>", +} + + +/////////////////////////////////////////////////////// HUP to HAP Template messages +{ + "path": "/hap/api/1.0/NativeAppStartNotification", + "AudioApp" : <1 | 0> +} + +{ + "path": "/hap/api/1.0/StartApplication", + "Name" : "<Name>" +} + +{ + "path": "/hup/api/1.0/RequestImage", + "ImageID" : <image ID int> +} + +{ + "path": "/hap/api/1.0/HardwareButtonPress", + "ButtonType" : "<Button | List>", + "Index" : "<index>", + "Type" : "Up" | "Down" | "Left" | "Right" | "Back" (APN unavailable) | "FFWD" | "Rewind" | "Next" | "Prev" | "PlayPause" | "ScrollDown" | "ScrollUp" | "ScrollLeft" | "ScrollRight" | "FlickDown" | "FlickUp" | "FlickLeft" | "FlickRight"> + "PressType" : <"Press" | "LongPress"> +} + +{ + "path": "/hap/api/1.0/StartPhoneCall", + "Name" : "<32 UTF-8 character name>", + "NameYomi" : "<128 UTF-8 reading name>", + "Number" : "<Phone number '0'-'9', '#', '+', '*'>" +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/applications.json b/Students/Dave Fugelso/Project/Alpine/testfiles/applications.json new file mode 100644 index 00000000..01144db5 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/applications.json @@ -0,0 +1,62 @@ +{ + "path": "/hup/api/1.0/ApplicationList", + "Applications" : [ + { + "Name" : "Pandora", + "Icon" : 64, + "Type" : 1, + "Languages" : [ + { + "Language" : "en", + "Local Name" : "English" + }, + { + "Language" : "fr", + "Local Name" : "French" + }, + { + "Language" : "jp", + "Local Name" : "Japonese" + } + ] + }, + { + "Name" : "IHeartRadio", + "Icon" : 40, + "Type" : 2, + "Languages" : [ + { + "Language" : "en", + "Local Name" : "English" + }, + { + "Language" : "fr", + "Local Name" : "French" + }, + { + "Language" : "jp", + "Local Name" : "Japonese" + } + ] + }, + { + "Name" : "Yelp", + "Icon" : 13, + "Type" : 2, + "Languages" : [ + { + "Language" : "English", + "Local Name" : "English" + }, + { + "Language" : "fr", + "Local Name" : "French" + }, + { + "Language" : "jp", + "Local Name" : "Japanese" + } + ] + } + ] +} \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/filecache.json b/Students/Dave Fugelso/Project/Alpine/testfiles/filecache.json new file mode 100644 index 00000000..acb9db2b --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/filecache.json @@ -0,0 +1,549 @@ +{ + "Files" : [ + { + "Size" : { + "Width" : 25, + "Height" : 25 + }, + "Filename" : "25x25A.png", + "ID" : 1 + }, + { + "Size" : { + "Width" : 25, + "Height" : 25 + }, + "Filename" : "25x25B.png", + "ID" : 2 + }, + { + "Size" : { + "Width" : 25, + "Height" : 25 + }, + "Filename" : "25x25C.png", + "ID" : 3 + }, + { + "Size" : { + "Width" : 25, + "Height" : 25 + }, + "Filename" : "25x25D.png", + "ID" : 4 + }, + { + "Size" : { + "Width" : 25, + "Height" : 25 + }, + "Filename" : "25x25E.png", + "ID" : 5 + }, + { + "Size" : { + "Width" : 28, + "Height" : 28 + }, + "Filename" : "28x28A.png", + "ID" : 6 + }, + { + "Size" : { + "Width" : 28, + "Height" : 28 + }, + "Filename" : "28x28B.png", + "ID" : 7 + }, + { + "Size" : { + "Width" : 28, + "Height" : 28 + }, + "Filename" : "28x28C.png", + "ID" : 8 + }, + { + "Size" : { + "Width" : 28, + "Height" : 28 + }, + "Filename" : "28x28D.png", + "ID" : 9 + }, + { + "Size" : { + "Width" : 28, + "Height" : 28 + }, + "Filename" : "28x28E.png", + "ID" : 10 + }, + { + "Size" : { + "Width" : 56, + "Height" : 64 + }, + "Filename" : "56x64A.png", + "ID" : 11 + }, + { + "Size" : { + "Width" : 56, + "Height" : 64 + }, + "Filename" : "56x64B.png", + "ID" : 12 + }, + { + "Size" : { + "Width" : 76, + "Height" : 60 + }, + "Filename" : "76x60A.png", + "ID" : 13 + }, + { + "Size" : { + "Width" : 76, + "Height" : 60 + }, + "Filename" : "76x60B.png", + "ID" : 14 + }, + { + "Size" : { + "Width" : 76, + "Height" : 60 + }, + "Filename" : "76x60C.png", + "ID" : 15 + }, + { + "Size" : { + "Width" : 76, + "Height" : 60 + }, + "Filename" : "76x60D.png", + "ID" : 16 + }, + { + "Size" : { + "Width" : 76, + "Height" : 60 + }, + "Filename" : "76x60E.png", + "ID" : 17 + }, + { + "Size" : { + "Width" : 76, + "Height" : 60 + }, + "Filename" : "76x60F.png", + "ID" : 18 + }, + { + "Size" : { + "Width" : 80, + "Height" : 64 + }, + "Filename" : "80x64A.png", + "ID" : 19 + }, + { + "Size" : { + "Width" : 80, + "Height" : 64 + }, + "Filename" : "80x64B.png", + "ID" : 20 + }, + { + "Size" : { + "Width" : 80, + "Height" : 64 + }, + "Filename" : "80x64C.png", + "ID" : 21 + }, + { + "Size" : { + "Width" : 80, + "Height" : 64 + }, + "Filename" : "80x64D.png", + "ID" : 22 + }, + { + "Size" : { + "Width" : 80, + "Height" : 64 + }, + "Filename" : "80x64E.png", + "ID" : 23 + }, + { + "Size" : { + "Width" : 80, + "Height" : 64 + }, + "Filename" : "80x64F.png", + "ID" : 24 + }, + { + "Size" : { + "Width" : 80, + "Height" : 80 + }, + "Filename" : "80x80A.png", + "ID" : 25 + }, + { + "Size" : { + "Width" : 80, + "Height" : 80 + }, + "Filename" : "80x80B.png", + "ID" : 26 + }, + { + "Size" : { + "Width" : 100, + "Height" : 100 + }, + "Filename" : "100x100A.png", + "ID" : 27 + }, + { + "Size" : { + "Width" : 100, + "Height" : 100 + }, + "Filename" : "100x100B.png", + "ID" : 28 + }, + { + "Size" : { + "Width" : 100, + "Height" : 100 + }, + "Filename" : "100x100C.png", + "ID" : 29 + }, + { + "Size" : { + "Width" : 100, + "Height" : 100 + }, + "Filename" : "100x100D.png", + "ID" : 30 + }, + { + "Size" : { + "Width" : 120, + "Height" : 64 + }, + "Filename" : "120x64A.png", + "ID" : 31 + }, + { + "Size" : { + "Width" : 120, + "Height" : 64 + }, + "Filename" : "120x64B.png", + "ID" : 32 + }, + { + "Size" : { + "Width" : 120, + "Height" : 64 + }, + "Filename" : "120x64C.png", + "ID" : 33 + }, + { + "Size" : { + "Width" : 135, + "Height" : 30 + }, + "Filename" : "135x30A.png", + "ID" : 34 + }, + { + "Size" : { + "Width" : 135, + "Height" : 30 + }, + "Filename" : "135x30B.png", + "ID" : 35 + }, + { + "Size" : { + "Width" : 135, + "Height" : 30 + }, + "Filename" : "135x30C.png", + "ID" : 36 + }, + { + "Size" : { + "Width" : 135, + "Height" : 30 + }, + "Filename" : "135x30D.png", + "ID" : 37 + }, + { + "Size" : { + "Width" : 135, + "Height" : 30 + }, + "Filename" : "135x30E.png", + "ID" : 38 + }, + { + "Size" : { + "Width" : 140, + "Height" : 60 + }, + "Filename" : "140x60A.png", + "ID" : 39 + }, + { + "Size" : { + "Width" : 140, + "Height" : 60 + }, + "Filename" : "140x60B.png", + "ID" : 40 + }, + { + "Size" : { + "Width" : 140, + "Height" : 60 + }, + "Filename" : "140x60C.png", + "ID" : 41 + }, + { + "Size" : { + "Width" : 140, + "Height" : 60 + }, + "Filename" : "140x60D.png", + "ID" : 42 + }, + { + "Size" : { + "Width" : 140, + "Height" : 60 + }, + "Filename" : "140x60E.png", + "ID" : 43 + }, + { + "Size" : { + "Width" : 140, + "Height" : 60 + }, + "Filename" : "140x60F.png", + "ID" : 44 + }, + { + "Size" : { + "Width" : 140, + "Height" : 64 + }, + "Filename" : "140x64A.png", + "ID" : 45 + }, + { + "Size" : { + "Width" : 140, + "Height" : 64 + }, + "Filename" : "140x64B.png", + "ID" : 46 + }, + { + "Size" : { + "Width" : 140, + "Height" : 64 + }, + "Filename" : "140x64C.png", + "ID" : 47 + }, + { + "Size" : { + "Width" : 140, + "Height" : 64 + }, + "Filename" : "140x64D.png", + "ID" : 48 + }, + { + "Size" : { + "Width" : 140, + "Height" : 64 + }, + "Filename" : "140x64E.png", + "ID" : 49 + }, + { + "Size" : { + "Width" : 140, + "Height" : 64 + }, + "Filename" : "140x64F.png", + "ID" : 50 + }, + { + "Size" : { + "Width" : 140, + "Height" : 64 + }, + "Filename" : "140x64G.png", + "ID" : 51 + }, + { + "Size" : { + "Width" : 140, + "Height" : 64 + }, + "Filename" : "140x64H.png", + "ID" : 52 + }, + { + "Size" : { + "Width" : 140, + "Height" : 64 + }, + "Filename" : "140x64I.png", + "ID" : 56 + }, + { + "Size" : { + "Width" : 200, + "Height" : 150 + }, + "Filename" : "200x150A.png", + "ID" : 57 + }, + { + "Size" : { + "Width" : 200, + "Height" : 150 + }, + "Filename" : "200x150B.png", + "ID" : 58 + }, + { + "Size" : { + "Width" : 200, + "Height" : 150 + }, + "Filename" : "200x150C.png", + "ID" : 59 + }, + { + "Size" : { + "Width" : 250, + "Height" : 22 + }, + "Filename" : "250x22A.png", + "ID" : 60 + }, + { + "Size" : { + "Width" : 250, + "Height" : 22 + }, + "Filename" : "250x22B.png", + "ID" : 61 + }, + { + "Size" : { + "Width" : 250, + "Height" : 22 + }, + "Filename" : "250x22C.png", + "ID" : 62 + }, + { + "Size" : { + "Width" : 250, + "Height" : 22 + }, + "Filename" : "250x22D.png", + "ID" : 63 + }, + { + "Size" : { + "Width" : 250, + "Height" : 45 + }, + "Filename" : "250x45A.png", + "ID" : 64 + }, + { + "Size" : { + "Width" : 250, + "Height" : 45 + }, + "Filename" : "250x45B.png", + "ID" : 65 + }, + { + "Size" : { + "Width" : 378, + "Height" : 22 + }, + "Filename" : "378x22A.png", + "ID" : 66 + }, + { + "Size" : { + "Width" : 478, + "Height" : 185 + }, + "Filename" : "478x185A.png", + "ID" : 67 + }, + { + "Size" : { + "Width" : 478, + "Height" : 233 + }, + "Filename" : "478x233A.png", + "ID" : 68 + }, + { + "Size" : { + "Width" : 500, + "Height" : 8 + }, + "Filename" : "500x8A.png", + "ID" : 69 + }, + { + "Size" : { + "Width" : 500, + "Height" : 8 + }, + "Filename" : "500x8B.png", + "ID" : 70 + }, + { + "Size" : { + "Width" : 500, + "Height" : 8 + }, + "Filename" : "500x8C.png", + "ID" : 71 + } + ] +} + \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/nowExecuting.json b/Students/Dave Fugelso/Project/Alpine/testfiles/nowExecuting.json new file mode 100644 index 00000000..610390c2 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/nowExecuting.json @@ -0,0 +1,5 @@ +{ + "path" : "/hup/api/1.0/NowExecuting", + "name" : "°āĂă", + "type" : 0 +} \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/requestAudioFocus.json b/Students/Dave Fugelso/Project/Alpine/testfiles/requestAudioFocus.json new file mode 100644 index 00000000..79f0c22d --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/requestAudioFocus.json @@ -0,0 +1,4 @@ +{ + "path" : "headunit/event", + "state" : "acquire" +} \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/setPhoneAvailability.json b/Students/Dave Fugelso/Project/Alpine/testfiles/setPhoneAvailability.json new file mode 100644 index 00000000..93a4f7f1 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/setPhoneAvailability.json @@ -0,0 +1,4 @@ +{ + "path" : "/hup/api/1.0/SetPhoneAvailability", + "available" : "yes" +} \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/setlocation.json b/Students/Dave Fugelso/Project/Alpine/testfiles/setlocation.json new file mode 100644 index 00000000..c995865e --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/setlocation.json @@ -0,0 +1,18 @@ +{ + "path": "/hup/api/1.0/SetLocation", + "latitude" : 34.17, + "longitude" : 118.25, + "type" : "destination", + "pointInformation" : { + "address" : "1234 Main Street", + "street" : "Main Street", + "houseNumber" : "1234", + "postalCode" : "98101", + "city" : "Glendale", + "state" : "California", + "country" : "United States", + "phone" : "1-908-123-4567", + "additionalInfo" : "Good Morning" + } +} + diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template1.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template1.json new file mode 100644 index 00000000..01d608ba --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template1.json @@ -0,0 +1,117 @@ +{ + "path": "/hup/api/1.0/Template1", + "partialUpdate" : "0", + "appId" : Pandora, + "screenId" : 236, + "loadingType" : "1", + "backgroundImage" : 1, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 2, + "text" : "Pandora Again!" + }, + "img01" : 3, + "img02" : 4, + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 5, + "pressed" : 6 + } + "backgroundImage" : { + "normal" : 7, + "pressed" : 8 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 9, + "pressed" : 10 + }, + "backgroundImage" : { + "normal" :11, + "pressed" : 12 + }, + "scrollUpButton" : 1, + "scrollDownButton" : 1, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : 15, + "pressed" : 16 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : 19, + "pressed" : 20 + } + + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 21, + "pressed" : 22 + }, + "backgroundImage" : { + "normal" : 23, + "pressed" : 24 + }, + "scrollUpButton" : "0", + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 25, + "pressed" : 26 + }, + "backgroundImage" : { + "normal" : 27, + "pressed" : 28 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + }, + "text01" : "text 01", + "text02" : "text 02", + "text03" : "text 03", + "text04" : "text 04", + "progress" : { + "color" : "FEFEFE", + "totalSeconds" : 630, + "current" : 0.54, + "active" : 1 + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template1A.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template1A.json new file mode 100644 index 00000000..da31a6fd --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template1A.json @@ -0,0 +1,118 @@ +{ + "path": "/hup/api/1.0/Template1", + "partialUpdate" : 0, + "templateId" : 1, + "appId" : "Pandora", + "screenId" : 236, + "loadingType" : 0, + "backgroundImage" : 1, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Pandora!" + }, + "img01" : 27, + "img02" : 1, + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 1, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 1, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + }, + "text01" : "text 01", + "text02" : "text 02", + "text03" : "text 03", + "text04" : "00:05:40", + "progress" : { + "color" : "FEFEFE", + "totalSeconds" : 630, + "current" : 0.54, + "active" : 1 + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template1A2.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template1A2.json new file mode 100644 index 00000000..a6f75138 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template1A2.json @@ -0,0 +1,118 @@ +{ + "path": "/hup/api/1.0/Template1", + "partialUpdate" : 1, + "templateId" : 1, + "appId" : "Pandora", + "screenId" : 236, + "loadingType" : 1, + "backgroundImage" : 1, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Pandora!" + }, + "img01" : 27, + "img02" : 1, + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 1, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 1, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + }, + "text01" : "text 01", + "text02" : "text 02", + "text03" : "text 03", + "text04" : "00:05:08", + "progress" : { + "color" : "FEFEFE", + "totalSeconds" : 630, + "current" : 0.54, + "active" : 1 + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template1A3.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template1A3.json new file mode 100644 index 00000000..a83ad623 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template1A3.json @@ -0,0 +1,118 @@ +{ + "path": "/hup/api/1.0/Template1", + "partialUpdate" : 1, + "templateId" : 1, + "appId" : "Pandora", + "screenId" : 236, + "loadingType" : 2, + "backgroundImage" : 1, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Pandora!" + }, + "img01" : 27, + "img02" : 1, + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 1, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 1, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + }, + "text01" : "text 01", + "text02" : "text 02", + "text03" : "text 03", + "text04" : "00:05:08", + "progress" : { + "color" : "FEFEFE", + "totalSeconds" : 630, + "current" : 0.54, + "active" : 1 + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template1B.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template1B.json new file mode 100644 index 00000000..52aec582 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template1B.json @@ -0,0 +1,146 @@ +{ + "path": "/hup/api/1.0/Template1", + "partialUpdate" : 0, + "templateId" : 1, + "appId" : "Pandora", + "screenId" : 236, + "loadingType" : 1, + "backgroundImage" : 1, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Pandora" + }, + "img01" : 25, + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 1, + "scrollDownButton" : 1, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "7" : + { + "text" : "button 6", + "image" : { + "normal" : 11, + "pressed" : 12 + }, + "backgroundImage" : { + "normal" : 12, + "pressed" : 11 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "8" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + }, + "text01" : "text 01", + "text02" : "text 02", + "text03" : "text 03", + "text04" : "00:05:08", + "progress" : { + "color" : "FEFEFE", + "totalSeconds" : 630, + "current" : 0.54, + "active" : 1 + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template1C.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template1C.json new file mode 100644 index 00000000..52e82c94 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template1C.json @@ -0,0 +1,147 @@ +{ + "path": "/hup/api/1.0/Template1", + "templateId" : 1, + "partialUpdate" : 0, + "appId" : "Pandora", + "screenId" : 236, + "loadingType" : 1, + "backgroundImage" : 1, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Pandora" + }, + "img01" : 26, + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 1, + "scrollDownButton" : 1, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "7" : + { + "text" : "button 6", + "image" : { + "normal" : 19, + "pressed" : 20 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "8" : + { + "text" : "button 6", + "image" : { + "normal" : 21, + "pressed" : 22 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + }, + "text01" : "text 01", + "text02" : "text 02", + "text03" : "text 03", + "text04" : "00:05:08", + "progress" : { + "color" : "FEFEFE", + "totalSeconds" : 630, + "current" : 0.54, + "active" : 1 + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template2.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template2.json new file mode 100644 index 00000000..0f70bc0f --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template2.json @@ -0,0 +1,155 @@ +{ + "path": "/hup/api/1.0/Template2", + "partialUpdate" : 0, + "appId" : "I heart radio", + "screenId" : 35, + "loadingType" : 1, + "backgroundImage" : 36, + "systemHeader" : 1 , + "templateContent" : + { + "title" : + { + "image" : 37, + "text" : "I heart radio" + }, + "img01" : 38, + "buttons" : + { + "1" : + { + "text" : "button 1", + "image" : { + "normal" : 55, + "pressed" : 56 + }, + "backgroundImage" : { + "normal" : 57, + "pressed" : 58 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 59, + "pressed" : 60 + }, + "backgroundImage" : { + "normal" : 61, + "pressed" : 62 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 63, + "pressed" : 64 + }, + "backgroundImage" : { + "normal" : 65, + "pressed" : 66 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" :67, + "pressed" : 68 + }, + "backgroundImage" : { + "normal" : 69, + "pressed" : 70 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 71, + "pressed" : 72 + }, + "backgroundImage" : { + "normal" : 73, + "pressed" : 74 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 75, + "pressed" : 76 + }, + "backgroundImage" : { + "normal" : 77, + "pressed" : 78 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "7" : { + "text" : "button 7", + "image" : { + "normal" : 79, + "pressed" : 80 + }, + "backgroundImage" : { + "normal" : 81, + "pressed" : 82 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "8" : + { + "text" : "button 8", + "image" : { + "normal" : 83, + "pressed" : 84 + }, + "backgroundImage" : { + "normal" : 85, + "pressed" : 86 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "9" : + { + "text" : "button 9", + "image" : { + "normal" : 87, + "pressed" : 88 + }, + "backgroundImage" : { + "normal" : 89, + "pressed" : 90 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template2A.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template2A.json new file mode 100644 index 00000000..0e917b06 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template2A.json @@ -0,0 +1,112 @@ +{ + "path": "/hup/api/1.0/Template2", + "templateId" : 2, + "partialUpdate" : 0, + "appId" : "I heart radio", + "screenId" : 35, + "loadingType" : 1, + "backgroundImage" : -1, + "systemHeader" : 1 , + "templateContent" : + { + "title" : + { + "image" : 65, + "text" : "I Heart Radio" + }, + "img03" : 69, + "buttons" : + { + "1" : + { + "text" : "button 1", + "image" : { + "normal" : 39, + "pressed" : 40 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 40, + "pressed" : 40 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 41, + "pressed" : 40 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 42, + "pressed" : 40 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 43, + "pressed" : 44 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 44, + "pressed" : 40 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template2B.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template2B.json new file mode 100644 index 00000000..1c5968bc --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template2B.json @@ -0,0 +1,156 @@ +{ + "path": "/hup/api/1.0/Template2", + "templateId" : 2, + "partialUpdate" : 0, + "appId" : "I heart radio", + "screenId" : 35, + "loadingType" : 1, + "backgroundImage" : -1, + "systemHeader" : 1 , + "templateContent" : + { + "title" : + { + "image" : 65, + "text" : "I Heart Radio" + }, + "img03" : 69, + "buttons" : + { + "1" : + { + "text" : "button 1", + "image" : { + "normal" : 45, + "pressed" : 46 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 47, + "pressed" : 46 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 48, + "pressed" : 46 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 49, + "pressed" : 46 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 50, + "pressed" : 46 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 51, + "pressed" : 46 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "7" : { + "text" : "button 7", + "image" : { + "normal" : 52, + "pressed" : 46 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "8" : + { + "text" : "button 8", + "image" : { + "normal" : 53, + "pressed" : 46 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "9" : + { + "text" : "button 9", + "image" : { + "normal" : 54, + "pressed" : 46 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template3.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template3.json new file mode 100644 index 00000000..97b9b35e --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template3.json @@ -0,0 +1,171 @@ + +{ + "path": "/hup/api/1.0/Template3", + "partialUpdate" : 0, + "appId" : "I Heart Radio", + "screenId" : 238, + "loadingType" : 2, + "backgroundImage" : 91, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 92, + "text" : "Template 3" + }, + + "list" : [ + { + "text" : "line text 1", + "image" : 93, + "special" : "special item 1" + }, + { + "text" : "line text 2", + "image" : 94, + "special" : "special item 2" + }, + { + "text" : "line text 3", + "image" : 95, + "special" : "special item 3" + }, + { + "text" : "line text 4", + "image" : 96, + "special" : "special item 4" + }, + { + "text" : "line text 5", + "image" : 97, + "special" : "special item 5" + }, + { + "text" : "line text 6", + "image" : 297, + "special" : "special item 6" + }, + { + "text" : "line text 7", + "image" : 397, + "special" : "special item 7" + }, + { + "text" : "line text 8", + "image" : 497, + "special" : "special item 8" + }, + { + "text" : "line text 9", + "image" : 597, + "special" : "special item 9" + }, + { + "text" : "line text 10", + "image" : 697, + "special" : "special item 10" + }, + { + "text" : "line text 11", + "image" : 797, + "special" : "special item 11" + }, + { + "text" : "line text 12", + "image" : 897, + "special" : "special item 12" + } + ], + + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 98, + "pressed" : 99 + }, + "backgroundImage" : { + "normal" : 100, + "pressed" : 101 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 102, + "pressed" : 103 + }, + "backgroundImage" : { + "normal" :104, + "pressed" : 105 + }, + "scrollUpButton" : 1, + "scrollDownButton" : 1, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 106, + "pressed" : 107 + }, + "backgroundImage" : { + "normal" : 108, + "pressed" : 109 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 110, + "pressed" : 111 + }, + "backgroundImage" : { + "normal" : 112, + "pressed" : 113 + } + + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 114, + "pressed" : 115 + }, + "backgroundImage" : { + "normal" : 116, + "pressed" : 117 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 118, + "pressed" : 119 + }, + "backgroundImage" : { + "normal" : 120, + "pressed" : 121 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + } + } + +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template3A.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template3A.json new file mode 100644 index 00000000..0f2ab573 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template3A.json @@ -0,0 +1,157 @@ + +{ + "path": "/hup/api/1.0/Template3", + "templateId" : 3, + "partialUpdate" : 0, + "appId" : "I Heart Radio", + "screenId" : 238, + "loadingType" : 2, + "backgroundImage" : 91, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 65, + "text" : "Template 3A" + }, + + "list" : [ + { + "text" : "line text 1", + "image" : 6 + }, + { + "text" : "line text 2", + "image" : 7 + }, + { + "text" : "line text 3", + "image" : 8 + }, + { + "text" : "line text 4", + "image" : 9 + }, + { + "text" : "line text 5", + "image" : 10 + }, + { + "text" : "line text 6", + "image" : 7 + }, + { + "text" : "line text 7", + "image" : 8 + }, + { + "text" : "line text 8", + "image" : 9 + }, + { + "text" : "line text 9", + "image" : 10 + }, + { + "text" : "line text 10", + "image" : 6 + }, + { + "text" : "line text 11", + "image" : 8 + }, + { + "text" : "line text 12", + "image" : 9 + } + ], + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : 0, + "scrollDown" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : 1, + "scrollDown" : 0, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : 0, + "scrollDown" : 1, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : 1, + "scrollDown" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUp" : 0, + "scrollDown" : 1, + "enabled" : 1 + } + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template3A.json.orig b/Students/Dave Fugelso/Project/Alpine/testfiles/template3A.json.orig new file mode 100644 index 00000000..b03655d6 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template3A.json.orig @@ -0,0 +1,160 @@ + +{ + "path": "/hup/api/1.0/Template3", + "templateId" : 3, + "partialUpdate" : false, + "appId" : "I Heart Radio", + "screenId" : 238, + "loadingType" : 2, + "backgroundImage" : 91, + "systemHeader" : true, + "templateContent" : { + "title" : { + "image" : 65, + "text" : "Template 3B" + }, + + "list" : [ + { + "text" : "line text 1", + "image" : 6 + }, + { + "text" : "line text 2", + "image" : 7 + }, + { + "text" : "line text 3", + "image" : 8 + }, + { + "text" : "line text 4", + "image" : 9 + }, + { + "text" : "line text 5", + "image" : 10 + }, + { + "text" : "line text 6", + "image" : 7 + }, + { + "text" : "line text 7", + "image" : 8 + }, + { + "text" : "line text 8", + "image" : 9 + }, + { + "text" : "line text 9", + "image" : 10 + }, + { + "text" : "line text 10", + "image" : 6 + }, + { + "text" : "line text 11", + "image" : 8 + }, + { + "text" : "line text 12", + "image" : 9 + } + ], + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : false, + "scrollDown" : false, + "enabled" : true + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, +<<<<<<< HEAD:Alpine/Glue/testfiles/template3A.json +======= + "scrollUp" : true, + "scrollDown" : false, + "enabled" : false +>>>>>>> f93a81d25a17e363d6c77ffc311ce11f58f86b9d:Alpine/Glue/template3A.json + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : false, + "scrollDown" : true, + "enabled" : true + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : true, + "scrollDown" : false, + "enabled" : true + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUp" : false, + "scrollDown" : true, + "enabled" : true + } + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template3B.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template3B.json new file mode 100644 index 00000000..f29fa25e --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template3B.json @@ -0,0 +1,181 @@ + +{ + "path": "/hup/api/1.0/Template3", + "templateId" : 3, + "partialUpdate" : 0, + "appId" : "I Heart Radio", + "screenId" : 238, + "loadingType" : 2, + "backgroundImage" : 91, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 65, + "text" : "Template 3B" + }, + + "list" : [ + { + "text" : "line text 1", + "image" : 6, + "special" : "special item 1", + "specialImage" : 34 + }, + { + "text" : "line text 2", + "image" : 7, + "special" : "special item 2", + "specialImage" : 35 + }, + { + "text" : "line text 3", + "image" : 8, + "special" : "special item 3", + "specialImage" : 36 + }, + { + "text" : "line text 4", + "image" : 9, + "special" : "special item 4", + "specialImage" : 37 + }, + { + "text" : "line text 5", + "image" : 10, + "special" : "special item 5", + "specialImage" : 38 + }, + { + "text" : "line text 6", + "image" : 7, + "special" : "special item 6", + "specialImage" : 36 + }, + { + "text" : "line text 7", + "image" : 8, + "special" : "special item 7", + "specialImage" : 37 + }, + { + "text" : "line text 8", + "image" : 9, + "special" : "special item 8", + "specialImage" : 38 + }, + { + "text" : "line text 9", + "image" : 10, + "special" : "special item 9", + "specialImage" : 34 + }, + { + "text" : "line text 10", + "image" : 6, + "special" : "special item 10", + "specialImage" : 35 + }, + { + "text" : "line text 11", + "image" : 8, + "special" : "special item 11", + "specialImage" : 36 + }, + { + "text" : "line text 12", + "image" : 9, + "special" : "special item 12", + "specialImage" : 37 + } + ], + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : 0, + "scrollDown" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : 0, + "scrollDown" : 0, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : 0, + "scrollDown" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUp" : 1, + "scrollDown" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUp" : 0, + "scrollDown" : 1, + "enabled" : 1 + } + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template4.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template4.json new file mode 100644 index 00000000..4e9859f7 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template4.json @@ -0,0 +1,62 @@ +{ + "path": "/hup/api/1.0/Template4", + "partialUpdate" : 0, + "appId" : "IHeartRadio", + "screenId" : 201, + "loadingType" : 2, + "backgroundImage" : -1, + "systemHeader" : 0, + "templateContent" : { + + "text01" : "Station Created", + "text02" : "Would you like to play a game", + + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 202, + "pressed" : 203 + }, + "backgroundImage" : { + "normal" : 204, + "pressed" : 205 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 206, + "pressed" : 207 + }, + "backgroundImage" : { + "normal" :208, + "pressed" : 209 + }, + "scrollUpButton" : 1, + "scrollDownButton" : 1, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 210, + "pressed" : 211 + }, + "backgroundImage" : { + "normal" : 212, + "pressed" : 213 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + } + } +} \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template4A.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template4A.json new file mode 100644 index 00000000..fe49797a --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template4A.json @@ -0,0 +1,54 @@ +{ + "path": "/hup/api/1.0/Template4", + "templateId" : 4, + "partialUpdate" : 0, + "appId" : "IHeartRadio", + "screenId" : 201, + "loadingType" : 1, + "backgroundImage" : -1, + "systemHeader" : 0, + "templateContent" : { + + "text01" : "Station Created", + "text02" : "Would you like to play a game", + + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 31, + "pressed" : 33 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 32, + "pressed" : 33 + }, + "backgroundImage" : { + "normal" :-1, + "pressed" : -1 + } + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 33, + "pressed" : 31 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + } + } + } +} \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template4B.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template4B.json new file mode 100644 index 00000000..fa3309b3 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template4B.json @@ -0,0 +1,54 @@ +{ + "path": "/hup/api/1.0/Template4", + "templateId" : 4, + "partialUpdate" : 0, + "appId" : "IHeartRadio", + "screenId" : 201, + "loadingType" : 1, + "backgroundImage" : -1, + "systemHeader" : 0, + "templateContent" : { + + "text01" : "Station Created", + "text02" : "Would you like to play a game", + + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 19, + "pressed" : 20 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 21, + "pressed" : 22 + }, + "backgroundImage" : { + "normal" :-1, + "pressed" : -1 + } + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 23, + "pressed" : 24 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + } + } + } +} \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template5.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template5.json new file mode 100644 index 00000000..79c6ad7f --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template5.json @@ -0,0 +1,93 @@ +{ + "path": "/hup/api/1.0/Template5", + "templateId" : 5, + "partialUpdate" : 0, + "appId" : "I Heart Radio", + "screenId" : 338, + "loadingType" : 1, + "backgroundImage" : 339, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Template 5" + }, + "text01" : "text line zero 1", + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + } + } + } + } +} \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template6.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template6.json new file mode 100644 index 00000000..9507d82d --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template6.json @@ -0,0 +1,98 @@ +{ + "path": "/hup/api/1.0/Template6", + "templateId" : 6, + "partialUpdate" : 0, + "appId" : "I Heart Radio", + "screenId" : 238, + "loadingType" : 2, + "backgroundImage" : 91, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Template 6" + }, + "line02" : { + "text" : "line 02 text", + "image" : 460 + }, + "img01" : 26, + "img03" : 70, + "text01" : "text line 01", + "text03" : "text line 03", + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + } + } + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template7.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template7.json new file mode 100644 index 00000000..18a4b7e9 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template7.json @@ -0,0 +1,113 @@ +{ + "path": "/hup/api/1.0/Template7", + "templateId" : 7, + "partialUpdate" : 0, + "appId" : "I Heart Radio", + "screenId" : 248, + "loadingType" : 2, + "backgroundImage" : 91, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Template 7" + }, + "line02" : { + "text" : "line 02 text", + "image" : 460 + }, + "img01" : 59, + "img03" : 60, + "text01" : "text line 01", + "text03" : "text line 03", + "buttons" : { + "1": + { + "text" : "button 1", + "image" : { + "normal" : 13, + "pressed" : 14 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "2" : + { + "text" : "button 2", + "image" : { + "normal" : 15, + "pressed" : 16 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 1, + "scrollDownButton" : 1, + "enabled" : 0 + }, + "3" : + { + "text" : "button 3", + "image" : { + "normal" : 17, + "pressed" : 18 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "4" : + { + "text" : "button 4", + "image" : { + "normal" : 14, + "pressed" : 13 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + } + }, + "5" : + { + "text" : "button 5", + "image" : { + "normal" : 16, + "pressed" : 15 + }, + "backgroundImage" : { + "normal" : -1, + "pressed" : -1 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + }, + "6" : + { + "text" : "button 6", + "image" : { + "normal" : 18, + "pressed" : 17 + }, + "backgroundImage" : { + "normal" : 13, + "pressed" : 14 + }, + "scrollUpButton" : 0, + "scrollDownButton" : 0, + "enabled" : 1 + } + } + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template8.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template8.json new file mode 100644 index 00000000..c007f7fe --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template8.json @@ -0,0 +1,18 @@ +{ + "path": "/hup/api/1.0/Template8", + "partialUpdate" : 0, + "appId" : "I Heart Radio", + "screenId" : 248, + "loadingType" : 2, + "backgroundImage" : 91, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 750, + "text" : "Template 8" + }, + "img01" : 761, + "img02" : 762, + "text01" : "text line 01" + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template8A.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template8A.json new file mode 100644 index 00000000..d806a368 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template8A.json @@ -0,0 +1,19 @@ +{ + "path": "/hup/api/1.0/Template8", + "templateId" : 8, + "partialUpdate" : 0, + "appId" : "I Heart Radio", + "screenId" : 248, + "loadingType" : 2, + "backgroundImage" : 91, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Template 8A" + }, + "img01" : 68, + "img02" : -1, + "text01" : "Flügel" + } +} diff --git a/Students/Dave Fugelso/Project/Alpine/testfiles/template8B.json b/Students/Dave Fugelso/Project/Alpine/testfiles/template8B.json new file mode 100644 index 00000000..d48db360 --- /dev/null +++ b/Students/Dave Fugelso/Project/Alpine/testfiles/template8B.json @@ -0,0 +1,19 @@ +{ + "path": "/hup/api/1.0/Template8", + "templateId" : 8, + "partialUpdate" : 0, + "appId" : "I Heart Radio", + "screenId" : 248, + "loadingType" : 2, + "backgroundImage" : 91, + "systemHeader" : 1, + "templateContent" : { + "title" : { + "image" : 64, + "text" : "Template 8B" + }, + "img01" : -1, + "img02" : 67, + "text01" : "text line 01" + } +} diff --git a/Students/Dave Fugelso/Project/Introduction to Python Project Report.docx b/Students/Dave Fugelso/Project/Introduction to Python Project Report.docx new file mode 100644 index 00000000..7f8c356a Binary files /dev/null and b/Students/Dave Fugelso/Project/Introduction to Python Project Report.docx differ diff --git a/Students/Dave Fugelso/Project/The pain and suffering that went into getting PyQt 4 installed on Ubuntu.docx b/Students/Dave Fugelso/Project/The pain and suffering that went into getting PyQt 4 installed on Ubuntu.docx new file mode 100644 index 00000000..fc4cc04d Binary files /dev/null and b/Students/Dave Fugelso/Project/The pain and suffering that went into getting PyQt 4 installed on Ubuntu.docx differ diff --git a/Students/Dave Fugelso/Project/pyqt/_HupInterface.py b/Students/Dave Fugelso/Project/pyqt/_HupInterface.py new file mode 100644 index 00000000..d2c55322 --- /dev/null +++ b/Students/Dave Fugelso/Project/pyqt/_HupInterface.py @@ -0,0 +1,240 @@ +''' +Python course project. + +This implements templates for simulation. Please see write up. + +''' +import sys +from PyQt4.QtGui import QApplication, QDialog +from ui_template import * +from functools import partial + + + +class Button (object): + + def __init__(self, *args, **kwargs): + ''' + Store info for a button. The args are well known. + ''' + print 'Add Button' + print args + self.text = args[0] + self.normalImage = args[1] + self.normalImagePressed = args[2] + self.backgroundImage = args[3] + self.backgroundImagePressed = args[4] + self.scrollUpButton = args[5] + self.scrollDownButton = args[5] + self.enabled = args[6] + self.key = -1 + + @property + def Key (self): + return self.key + + @Key.setter + def Key(self, key): + self.key = key + +class pyqtTemplate(object): + + def __init__(self): + self.Buttons = [None for i in range(9)] #max nine buttons + self.buttonIndex = 0 + self.partialUpdate = None + self.appId = None + self.loadingType = None + self.screenId = None + self.backgroundImage = None + self.systemHeader = None + self.colrRGB = None + self.current = None + self.totlaseconds = None + self.active = None + self.path = None + self.key = None + self.callback = None + + def addButtons(self, *args, **kwargs): + ''' + Add button to template. Buttons are sent in order. + ''' + self.Buttons[self.buttonIndex] = Button(*args, **kwargs) + self.buttonIndex += 1 + + def clearButtonList(self): + ''' + Clear list for next display. + ''' + self.Buttons = [None for i in range(9)] #max nine buttons + + def setContentTemplateHeader(self, *args, **kwargs): + ''' + Set header informaiton. + ''' + self.partialUpdate = args[0] + self.appId = args[1] + self.loadingType = args[2] + self.screenId = args[3] + self.backgroundImage = args[4] + self.systemHeader = args[5] + + def setContentProgressBar(self, *args, **kwargs): + ''' + Progress bar update. + ''' + self.colorRGB = args[0] + self.current = args[1] + self.totlaseconds = args[2] + self.active = args[3] + + def sendImage (self, *args, **kwargs): + ''' + Returns a request image. (Btw this calls a registered callback. This function would normal + call the registered callback, thus the 'Send' instead of 'Receive.' + + Also, this method would normally be asynchronous, but it isn't here. (It would find the right button based on key.) + ''' + + #find widget by name + wid = getattr(self.ui, self.name) + + if isinstance(wid, QtGui.QLabel): + print 'have Qlabel!' + wid.setPixmap (QtGui.QPixmap(args[0])) + else: + icon = QtGui.QPixmap(args[0]) + wid.setIcon(QtGui.QIcon(icon)) + size = wid.frameSize () + wid.setIconSize(QtCore.QSize(size.height(),size.width())) + print self.button.key + #wid.clicked.connect(lambda: self.buttonClick(self.button.Key)) + wid.clicked.connect(partial(self.buttonClick, self.button.Key)) + + + def startPlatformInitialization(self, alpineInterfaceCallback): + ''' + This defines the callback function to make calls back into HUP. + ''' + self.callback = alpineInterfaceCallback + + def buttonClick (self, key): + ''' + Pass a button click back to HUIP for processising. + ''' + cbDict = {} + cbDict['Index'] = key + cbDict['templateId'] = self.appId + cbDict['type'] = 0 + self.callback('TemplateButtonPress', cbDict) + + + def setContentTemplate1 (self, *args, **kwargs): + buttonNames = ('btn01', 'btn02', 'btn03', 'btn04', 'btn05', 'btn06') + print 'Template 1 display' + self.image = args[0] + self.titlestr = args[1] + self.img01 = args[2] + self.img02 = args[3] + self.text01 = args[4] + self.text02 = args[5] + self.text03 = args[6] + self.text04 = args[7] + + app = QApplication(sys.argv) + window = QDialog() + self.ui = Ui_Template1() + self.ui.setupUi(window) + + #For each button gets its image () + processButtons = zip (buttonNames, self.Buttons, range(1,7)) + for self.name, self.button, self.buttonId in processButtons: + ''' + Requests to HUP are dictionaries. + ''' + request = {} + request['ImageID'] = self.button.normalImage + + #register callback for button + self.button.Key = self.buttonId + + #request the image + self.callback ('RequestImage', request) + + + + + #Other images in the frameSize + self.name = 'img01' + request['ImageID'] = self.img01 + self.callback ('RequestImage', request) + self.name = 'img02' + request['ImageID'] = self.img02 + self.callback ('RequestImage', request) + + #Set the text field (normally this would take into consideration length to set size. + wid = getattr(self.ui, 'imgtitle') + wid.setText (QtCore.QString(self.titlestr)) + wid = getattr(self.ui, 'text01') + wid.setText (QtCore.QString(self.text01)) + wid = getattr(self.ui, 'text02') + wid.setText (QtCore.QString(self.text02)) + wid = getattr(self.ui, 'text03') + wid.setText (QtCore.QString(self.text03)) + wid = getattr(self.ui, 'text04') + wid.setText (QtCore.QString(self.text04)) + + #Update progress bar + wid = getattr(self.ui, 'text04') + wid.setText (QtCore.QString(self.text04)) + wid = getattr(self.ui, 'progbar') + wid.setMinimum(0) + wid.setMaximum(self.totlaseconds) + wid.setValue (self.current * self.totlaseconds) + + window.show() + sys.exit(app.exec_()) + +# Instance of template +P = pyqtTemplate () + + +''' +These function simulate the C functions that is the real interface. +''' +def AddButton (*args, **kwargs): + P.addButtons(*args, **kwargs) + +def ClearButtonList (): + P.clearButtonList() + +def SetContentTemplateHeader(*args, **kwargs): + P.setContentTemplateHeader(*args, **kwargs) + +def SetContentProgressBar(*args, **kwargs): + P.setContentProgressBar(*args, **kwargs) + +def SendImage (*args, **kwargs): + P.sendImage (*args, **kwargs) + +def startPlatformInitialization(alpineInterfaceCallback): + P.startPlatformInitialization(alpineInterfaceCallback) + +def SetContentTemplate1 (*args, **kwargs): + P.setContentTemplate1(*args, **kwargs) + +''' +Unimplemented code. this allows me to replace the C module _HupInterface +''' +def SendNowExecuting (*arg, **kwargs): + pass + +def SendRequestAudioFocus(*arg, **kwargs): + pass + +def SendSetLocation(*arg, **kwargs): + pass + +def SendSetLocation(*arg, **kwargs): + pass \ No newline at end of file diff --git a/Students/Dave Fugelso/Project/pyqt/template1.ui b/Students/Dave Fugelso/Project/pyqt/template1.ui new file mode 100644 index 00000000..33159468 --- /dev/null +++ b/Students/Dave Fugelso/Project/pyqt/template1.ui @@ -0,0 +1,217 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Template1</class> + <widget class="QDialog" name="Template1"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>500</width> + <height>300</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <widget class="QToolButton" name="btn01"> + <property name="geometry"> + <rect> + <x>17</x> + <y>223</y> + <width>76</width> + <height>60</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QToolButton" name="btn02"> + <property name="geometry"> + <rect> + <x>95</x> + <y>223</y> + <width>76</width> + <height>60</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QToolButton" name="btn03"> + <property name="geometry"> + <rect> + <x>173</x> + <y>223</y> + <width>76</width> + <height>60</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QToolButton" name="btn04"> + <property name="geometry"> + <rect> + <x>251</x> + <y>223</y> + <width>76</width> + <height>60</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QToolButton" name="btn05"> + <property name="geometry"> + <rect> + <x>329</x> + <y>223</y> + <width>76</width> + <height>60</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QToolButton" name="btn06"> + <property name="geometry"> + <rect> + <x>407</x> + <y>223</y> + <width>76</width> + <height>60</height> + </rect> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + <widget class="QLabel" name="img01"> + <property name="geometry"> + <rect> + <x>16</x> + <y>84</y> + <width>100</width> + <height>100</height> + </rect> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + <widget class="QLabel" name="img02"> + <property name="geometry"> + <rect> + <x>463</x> + <y>70</y> + <width>25</width> + <height>25</height> + </rect> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + <widget class="QLabel" name="imgtitle"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>250</width> + <height>45</height> + </rect> + </property> + <property name="font"> + <font> + <family>Saab</family> + <pointsize>25</pointsize> + </font> + </property> + <property name="autoFillBackground"> + <bool>true</bool> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + <widget class="QLineEdit" name="text01"> + <property name="geometry"> + <rect> + <x>128</x> + <y>84</y> + <width>310</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLineEdit" name="text02"> + <property name="geometry"> + <rect> + <x>128</x> + <y>112</y> + <width>310</width> + <height>24</height> + </rect> + </property> + </widget> + <widget class="QLineEdit" name="text03"> + <property name="geometry"> + <rect> + <x>128</x> + <y>146</y> + <width>310</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLineEdit" name="text04"> + <property name="geometry"> + <rect> + <x>406</x> + <y>194</y> + <width>72</width> + <height>18</height> + </rect> + </property> + </widget> + <widget class="QProgressBar" name="progbar"> + <property name="geometry"> + <rect> + <x>128</x> + <y>197</y> + <width>270</width> + <height>14</height> + </rect> + </property> + <property name="value"> + <number>24</number> + </property> + </widget> + <widget class="QLabel" name="sbar"> + <property name="geometry"> + <rect> + <x>250</x> + <y>0</y> + <width>250</width> + <height>45</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Students/Dave Fugelso/Project/pyqt/ui_template.py b/Students/Dave Fugelso/Project/pyqt/ui_template.py new file mode 100644 index 00000000..83e5b11b --- /dev/null +++ b/Students/Dave Fugelso/Project/pyqt/ui_template.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'template1.ui' +# +# Created: Thu Dec 11 21:43:48 2014 +# by: PyQt4 UI code generator 4.11.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + def _fromUtf8(s): + return s + +try: + _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig, _encoding) +except AttributeError: + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig) + +class Ui_Template1(object): + def setupUi(self, Template1): + Template1.setObjectName(_fromUtf8("Template1")) + Template1.resize(500, 300) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(Template1.sizePolicy().hasHeightForWidth()) + Template1.setSizePolicy(sizePolicy) + self.btn01 = QtGui.QToolButton(Template1) + self.btn01.setGeometry(QtCore.QRect(17, 223, 76, 60)) + self.btn01.setObjectName(_fromUtf8("btn01")) + self.btn02 = QtGui.QToolButton(Template1) + self.btn02.setGeometry(QtCore.QRect(95, 223, 76, 60)) + self.btn02.setObjectName(_fromUtf8("btn02")) + self.btn03 = QtGui.QToolButton(Template1) + self.btn03.setGeometry(QtCore.QRect(173, 223, 76, 60)) + self.btn03.setObjectName(_fromUtf8("btn03")) + self.btn04 = QtGui.QToolButton(Template1) + self.btn04.setGeometry(QtCore.QRect(251, 223, 76, 60)) + self.btn04.setObjectName(_fromUtf8("btn04")) + self.btn05 = QtGui.QToolButton(Template1) + self.btn05.setGeometry(QtCore.QRect(329, 223, 76, 60)) + self.btn05.setObjectName(_fromUtf8("btn05")) + self.btn06 = QtGui.QToolButton(Template1) + self.btn06.setGeometry(QtCore.QRect(407, 223, 76, 60)) + self.btn06.setObjectName(_fromUtf8("btn06")) + self.img01 = QtGui.QLabel(Template1) + self.img01.setGeometry(QtCore.QRect(16, 84, 100, 100)) + self.img01.setObjectName(_fromUtf8("img01")) + self.img02 = QtGui.QLabel(Template1) + self.img02.setGeometry(QtCore.QRect(463, 70, 25, 25)) + self.img02.setObjectName(_fromUtf8("img02")) + self.imgtitle = QtGui.QLabel(Template1) + self.imgtitle.setGeometry(QtCore.QRect(0, 0, 250, 45)) + font = QtGui.QFont() + font.setFamily(_fromUtf8("Saab")) + font.setPointSize(25) + self.imgtitle.setFont(font) + self.imgtitle.setAutoFillBackground(True) + self.imgtitle.setObjectName(_fromUtf8("imgtitle")) + self.text01 = QtGui.QLineEdit(Template1) + self.text01.setGeometry(QtCore.QRect(128, 84, 310, 22)) + self.text01.setObjectName(_fromUtf8("text01")) + self.text02 = QtGui.QLineEdit(Template1) + self.text02.setGeometry(QtCore.QRect(128, 112, 310, 24)) + self.text02.setObjectName(_fromUtf8("text02")) + self.text03 = QtGui.QLineEdit(Template1) + self.text03.setGeometry(QtCore.QRect(128, 146, 310, 22)) + self.text03.setObjectName(_fromUtf8("text03")) + self.text04 = QtGui.QLineEdit(Template1) + self.text04.setGeometry(QtCore.QRect(406, 194, 72, 18)) + self.text04.setObjectName(_fromUtf8("text04")) + self.progbar = QtGui.QProgressBar(Template1) + self.progbar.setGeometry(QtCore.QRect(128, 197, 270, 14)) + self.progbar.setProperty("value", 24) + self.progbar.setObjectName(_fromUtf8("progbar")) + self.sbar = QtGui.QLabel(Template1) + self.sbar.setGeometry(QtCore.QRect(250, 0, 250, 45)) + self.sbar.setText(_fromUtf8("")) + self.sbar.setObjectName(_fromUtf8("sbar")) + + self.retranslateUi(Template1) + QtCore.QMetaObject.connectSlotsByName(Template1) + + def retranslateUi(self, Template1): + Template1.setWindowTitle(_translate("Template1", "Dialog", None)) + self.btn01.setText(_translate("Template1", "...", None)) + self.btn02.setText(_translate("Template1", "...", None)) + self.btn03.setText(_translate("Template1", "...", None)) + self.btn04.setText(_translate("Template1", "...", None)) + self.btn05.setText(_translate("Template1", "...", None)) + self.btn06.setText(_translate("Template1", "...", None)) + self.img01.setText(_translate("Template1", "TextLabel", None)) + self.img02.setText(_translate("Template1", "TextLabel", None)) + self.imgtitle.setText(_translate("Template1", "TextLabel", None)) + diff --git a/Students/Dave Fugelso/Project/screenshot.png b/Students/Dave Fugelso/Project/screenshot.png new file mode 100644 index 00000000..e16b60b2 Binary files /dev/null and b/Students/Dave Fugelso/Project/screenshot.png differ diff --git a/Students/Dave Fugelso/Project/template1A Picture.PNG b/Students/Dave Fugelso/Project/template1A Picture.PNG new file mode 100644 index 00000000..edd96216 Binary files /dev/null and b/Students/Dave Fugelso/Project/template1A Picture.PNG differ diff --git a/Students/Dave Fugelso/Session 7/Circle.py b/Students/Dave Fugelso/Session 7/Circle.py new file mode 100644 index 00000000..59503916 --- /dev/null +++ b/Students/Dave Fugelso/Session 7/Circle.py @@ -0,0 +1,65 @@ +''' + +Defines Circle Class. + +''' + +from math import pi + +class Circle (object): + ''' + Defines methods and attributes that apply to a circle. + ''' + def __init__(self, radius): + self.radius = float(radius) + + @property + def diameter(self): + return self.radius * 2. + + @diameter.setter + def diameter (self, val): + self.radius = val/2. + + def area(self): + ''' + Calculate the area of this circle + ''' + return self.radius*self.radius * pi + + @classmethod + def from_diameter(cls, diameter): + return cls(diameter/2.) + + def __repr__(self): + return 'Circle.Circle({})'.format(self.radius) + + def __str__(self): + return 'Circle wih radius {}'.format(self.radius) + + def __add__(self, other): + if isinstance(other, Circle): + return Circle (self.radius + other.radius) + else: + self.radius += other + return self + + def __mul__(self, other): + if isinstance(other, Circle): + return Circle (self.radius * other.radius) + else: + self.radius *= other + return self + + def __rmul__(self, other): + self.radius *= other + return self + + def __gt__(self, other): + return self.radius > other.radius + + def __lt__(self, other): + return self.radius < other.radius + + def __eq__(self, other): + return self.radius == other.radius \ No newline at end of file diff --git a/Students/Dave Fugelso/Session 7/circle_test.py b/Students/Dave Fugelso/Session 7/circle_test.py new file mode 100644 index 00000000..dcb73450 --- /dev/null +++ b/Students/Dave Fugelso/Session 7/circle_test.py @@ -0,0 +1,81 @@ +''' +These are all the unit test to make sure circle works as expected. + +Really taking these seriously as feedback from last homework assignment indicated I should. +I skipped the unit tests and did step tests. Not this time! +''' + +import Circle +import unittest +import math + +class TestCircleClass (unittest.TestCase): # note didn't save class notes. Wrote this first! + + def test_create_circle(self): + # First test, instantiate the circle class + c = Circle.Circle (3) + print c.radius + + def test_get_diameter(self): + c = Circle.Circle (3.) # Test fetching diameter + print c.diameter + + def test_set_diameter(self): + c = Circle.Circle (3.) # Test setting diameter + c.diameter = 7 + print c.diameter + assert c.diameter == 7. + assert c.radius == 3.5 + + def test_area (self): + c = Circle.Circle (3.) + print c.area() + assert c.area() == math.pi * 9. + + def test_alternate_constructor(self): + c = Circle.Circle.from_diameter(8) + print c.diameter + print c.radius + assert c.diameter == 8 + assert c.radius == 4 + + def test_repr_and_str_builtins(self): + c = Circle.Circle(4) + print c + print 'Expected: "Circle with radius: 4.000000"' + + print repr(c) + print 'Expected: "Circle(4)"' + + d = eval(repr(c)) + print d + print 'Expected: "Circle(4)"' + + def test_add_and_mul(self): + c1 = Circle.Circle(2) + c2 = Circle.Circle(4) + print c1 + c2 + print 'Expected: "Circle(6)"' + print c2 * 3 + print 'Expected: "Circle(12)"' + print 3 * c2 + print 'Expected: "Circle(12)"' + + def test_comparisons (self): + c1 = Circle.Circle(2) + c2 = Circle.Circle(4) + c3 = Circle.Circle(4) + + assert c1 < c2 + assert not c1 > c3 + assert not c1 == c2 + assert c2 == c3 + + def test_sort(self): + circles = [Circle.Circle(6), Circle.Circle(7), Circle.Circle(8), Circle.Circle(4), Circle.Circle(0), Circle.Circle(2), Circle.Circle(3), Circle.Circle(5), Circle.Circle(9), Circle.Circle(1)] + print circles + print circles.sort() + +if __name__ =='__main__': + unittest.main() + \ No newline at end of file diff --git a/Students/Dave Fugelso/Session 8/Sparse.py b/Students/Dave Fugelso/Session 8/Sparse.py new file mode 100644 index 00000000..1e1014ac --- /dev/null +++ b/Students/Dave Fugelso/Session 8/Sparse.py @@ -0,0 +1,80 @@ +''' +Sparse Array + +Note, missed class out of town so not quite sure I know what this needs to do. + +But, only store elements that have values and assume that the key is 0 to n-1 where n is the total +length of the array. + +__init__ is how? +static length or allow to grow/shrink? + +Decisions: + +1. Init with just a length. +2. May explicitly change size with setSize. Deletes entries out of range on shrink. +3. Use set to populate array + +Implement with dictionary + +''' + +class Sparse(object): + + _length = 0 + array = {} + def __init__(self, size): + self._length = size; + + @property + def length (self): + return self._length + + @length.setter + def length (self, newlength): + ''' + if expanding just change length, but if shortening, delete entries greater than range. + ''' + if newlength < self._length: + for index in self.array.keys(): + if index >= self._length: + self.array.pop(index, None) + self._length = newlength + + def __len__(self): + ''' + Len for iteration. + ''' + return self._length + + def __getitem__(self, index): + ''' + return element at index or zero if none. + ''' + if index < 0 or index >= self.length: + raise IndexError ('Sparse Array out of range') + else: + return self.array.get(index, 0) + + def __setitem__ (self, index, value): + ''' + Set item if in range. If value is zero, remove item. + ''' + if index < 0 or index >= self.length: + raise IndexError ('Sparse Array out of range') + elif value == 0: + self.array.pop(index, None) + else: + self.array[index] = value + + def __delitem__ (self, index): + ''' + Delete an item. + ''' + if index < 0 or index >= self.length: + raise IndexError ('Sparse Array out of range') + else: + self.array.pop(index, None) + + + \ No newline at end of file diff --git a/Students/Dave Fugelso/Session 8/generator_solution.py b/Students/Dave Fugelso/Session 8/generator_solution.py new file mode 100644 index 00000000..cf952c15 --- /dev/null +++ b/Students/Dave Fugelso/Session 8/generator_solution.py @@ -0,0 +1,104 @@ +def y_xrange(start, stop, step=1): + i = start + while i < stop: + yield i + i += step + + + +def intsum(): + ''' + keep adding the next integer + + 0 + 1 + 2 + 3 + 4 + 5 + ... + + so the sequence is: + + 0, 1, 3, 6, 10, 15 ..... + ''' + i = 0 + sum = 0 + + while True: + sum = i + sum + yield sum + i += 1 + + +def intsum2(): + ''' + test_generator has a intsum2... dunno why + ''' + i = 0 + sum = 0 + + while True: + sum = i + sum + yield sum + i += 1 + +def doubler(): + ''' + Doubler: + Each value is double the previous value: + + 1, 2, 4, 8, 16, 32, + ''' + sum = 1 + while True: + yield sum + sum += sum + +def fib(): + ''' + Fibonacci sequence: + The fibonacci sequence as a generator: + + f(n) = f(n-1) + f(n-2) + + 1, 1, 2, 3, 5, 8, 13, 21, 34... + ''' + yield 1 + x = 0 + y = 1 + while True: + yield x+y + x, y = y, x+y + + + + + +def isprime(n): + '''check if integer n is a prime''' + # make sure n is a positive integer + n = abs(int(n)) + # 0 and 1 are not primes + if n < 2: + return False + # 2 is the only even prime number + if n == 2: + return True + # all other even numbers are not primes + if not n & 1: + return False + # range starts with 3 and only needs to go up the squareroot of n + # for all odd numbers + for x in range(3, int(n**0.5)+1, 2): + if n % x == 0: + return False + return True + +def prime(): + ''' + Prime numbers: + Generate the prime numbers (numbers only divisible by them self and 1): + + 2, 3, 5, 7, 11, 13, 17, 19, 23... + ''' + i = 2 + while True: + while not isprime (i): + i += 1 + yield i + i += 1 \ No newline at end of file diff --git a/Students/Dave Fugelso/Session 8/iterator.py b/Students/Dave Fugelso/Session 8/iterator.py new file mode 100644 index 00000000..3d621d74 --- /dev/null +++ b/Students/Dave Fugelso/Session 8/iterator.py @@ -0,0 +1,8 @@ +''' +Extend iterator_1 to do xrange-like iteration +''' + +from iterator_1 import IterateMe_1 + +class iterator (IterateMe_1): + diff --git a/Students/Dave Fugelso/Session 8/iterator_1.py b/Students/Dave Fugelso/Session 8/iterator_1.py new file mode 100644 index 00000000..f2402385 --- /dev/null +++ b/Students/Dave Fugelso/Session 8/iterator_1.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +""" +Simple iterator examples +""" + + +class IterateMe_1(object): + """ + About as simple an iterator as you can get: + + returns the sequence of numbers from zero to 4 + ( like xrange(4) ) + """ + def __init__(self, stop=5): + self.current = -1 + self.stop = stop + def __iter__(self): + return self + def next(self): + self.current += 1 + if self.current < self.stop: + return self.current + else: + raise StopIteration + +if __name__ == "__main__": + + print "Testing the iterator" + for i in IterateMe_1(): + print i + diff --git a/Students/Dave Fugelso/Session 8/test_generator.py b/Students/Dave Fugelso/Session 8/test_generator.py new file mode 100644 index 00000000..cf02fae5 --- /dev/null +++ b/Students/Dave Fugelso/Session 8/test_generator.py @@ -0,0 +1,78 @@ +""" +test_generator.py + +tests the solution to the generator lab + +can be run with py.test or nosetests +""" + +import generator_solution as gen + + +def test_intsum(): + + g = gen.intsum() + + assert g.next() == 0 + assert g.next() == 1 + assert g.next() == 3 + assert g.next() == 6 + assert g.next() == 10 + assert g.next() == 15 + + +def test_intsum2(): + + g = gen.intsum2() + + assert g.next() == 0 + assert g.next() == 1 + assert g.next() == 3 + assert g.next() == 6 + assert g.next() == 10 + assert g.next() == 15 + + +def test_doubler(): + + g = gen.doubler() + + assert g.next() == 1 + assert g.next() == 2 + assert g.next() == 4 + assert g.next() == 8 + assert g.next() == 16 + assert g.next() == 32 + + for i in range(10): + j = g.next() + + assert j == 2**15 + + +def test_fib(): + g = gen.fib() + + assert g.next() == 1 + assert g.next() == 1 + assert g.next() == 2 + assert g.next() == 3 + assert g.next() == 5 + assert g.next() == 8 + assert g.next() == 13 + assert g.next() == 21 + + +def test_prime(): + g = gen.prime() + + assert g.next() == 2 + assert g.next() == 3 + assert g.next() == 5 + assert g.next() == 7 + assert g.next() == 11 + assert g.next() == 13 + assert g.next() == 17 + assert g.next() == 19 + assert g.next() == 23 + diff --git a/Students/Dave Fugelso/Session 8/test_iterator.py b/Students/Dave Fugelso/Session 8/test_iterator.py new file mode 100644 index 00000000..b11c8ca3 --- /dev/null +++ b/Students/Dave Fugelso/Session 8/test_iterator.py @@ -0,0 +1,14 @@ +''' +test_iterating class +''' + + +from iterator import Sparse +import unittest + +def test_iteration(self): + for i in iterator_inst(0, 50, step=1): + + +if __name__ =='__main__': + unittest.main() \ No newline at end of file diff --git a/Students/Dave Fugelso/Session 8/test_sparse.py b/Students/Dave Fugelso/Session 8/test_sparse.py new file mode 100644 index 00000000..41d47002 --- /dev/null +++ b/Students/Dave Fugelso/Session 8/test_sparse.py @@ -0,0 +1,100 @@ +''' +Sparse array unit tests. + +Note: I didn't see that there was a test_sparse_array in solutions... + +''' + +from Sparse import Sparse +import unittest + + +class TestSparseClass (unittest.TestCase): + + def populate_array(self, s): + s[5] = 100 + s[15] = 99 + s[25] = 98 + s[35] = 97 + s[45] = 96 + s[55] = 95 + + + def test_create_sparse(self): + # Create and print a spare array w/100 elements + s = Sparse (100) + print s + + def test_get_item (self): + s = Sparse (100) + self.populate_array(s) + assert s[5] == 100 + assert s[6] == 0 + + def test_del (self): + s = Sparse (100) + self.populate_array(s) + del (s[5]) + assert s[5] == 0 + + + def test_range_set_get(self): + s = Sparse (100) + self.populate_array(s) + with self.assertRaises(IndexError) as context: + i = s[-1] + self.assertEqual(context.exception.message, 'Sparse Array out of range') + + with self.assertRaises(IndexError) as context: + i = s[100] + self.assertEqual(context.exception.message, 'Sparse Array out of range') + + with self.assertRaises(IndexError) as context: + s[-1] = 5 + self.assertEqual(context.exception.message, 'Sparse Array out of range') + + with self.assertRaises(IndexError) as context: + s[100] = 5 + self.assertEqual(context.exception.message, 'Sparse Array out of range') + + with self.assertRaises(IndexError) as context: + del (s[100]) + self.assertEqual(context.exception.message, 'Sparse Array out of range') + + with self.assertRaises(IndexError) as context: + del(s[-1]) + self.assertEqual(context.exception.message, 'Sparse Array out of range') + + #with self.assertRaises(IndexError) as context: + # s[0] = 5 + #self.assertEqual(context.exception.message, 'Sparse Array out of range') + + def test_resize (self): + s = Sparse (100) + self.populate_array(s) + + # test smaller + s.length = 50 + with self.assertRaises(IndexError) as context: + a = s[55] + self.assertEqual(context.exception.message, 'Sparse Array out of range') + + # test back to larger + s.length = 100 + s[55] = 100 + assert (s[55] == 100) + + def test_iteration (self): + s = Sparse (100) + self.populate_array(s) + index = 0 + for val in s: + print index, val + assert val == s[index] + index += 1 + + + +if __name__ =='__main__': + unittest.main() + \ No newline at end of file diff --git a/Students/Dave Fugelso/Session 9/p_wrapper.py b/Students/Dave Fugelso/Session 9/p_wrapper.py new file mode 100644 index 00000000..f209701d --- /dev/null +++ b/Students/Dave Fugelso/Session 9/p_wrapper.py @@ -0,0 +1,32 @@ +''' +p_wrapper.py + +Define p_wrapper and tag_wrapper decorators. + +Since we aren't saving any state info will not use callable class. For p_wrapper. + +For tag_wrapper gonna make it callable class + +''' + + + +def p_wrapper (func): + def string_return (string): + return '<p> '+string+' </p>' + return string_return + +class tag_wrapper (object): + + def __init__(self, tag): + #print "Inside __init__()" + self.tag = tag + + def __call__(self, string): + #print "Inside __call__()" + def tagged_line (string): + # print 'decorator' + # print '<'+self.tag+'> '+string+' </'+self.tag+'>' + return '<'+self.tag+'> '+string+' </'+self.tag+'>' + return tagged_line + diff --git a/Students/Dave Fugelso/Session 9/test_p_wrapper.py b/Students/Dave Fugelso/Session 9/test_p_wrapper.py new file mode 100644 index 00000000..efd4cbc6 --- /dev/null +++ b/Students/Dave Fugelso/Session 9/test_p_wrapper.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +""" +test code for the p_wrapper assignment +""" + +from p_wrapper import p_wrapper, tag_wrapper + + +def test_p_wrapper(): + @p_wrapper + def return_a_string(string): + return string + print return_a_string('this is a string') + assert return_a_string('this is a string') == '<p> this is a string </p>' + +#Extra credit: + +def test_tag_wrapper(): + @tag_wrapper('html') + def return_a_string(string): + return string + + assert return_a_string("this is a string") == "<html> this is a string </html>" + +def test_tag_wrapper2(): + @tag_wrapper('div') + def return_a_string(string): + return string + + assert return_a_string("this is a string") == "<div> this is a string </div>" + diff --git a/Students/Dave Fugelso/Session 9/test_timer.py b/Students/Dave Fugelso/Session 9/test_timer.py new file mode 100644 index 00000000..8ee0c949 --- /dev/null +++ b/Students/Dave Fugelso/Session 9/test_timer.py @@ -0,0 +1,15 @@ +''' +Test timer context manager. +''' + +from timer import * + +def test_timer(): + print 'test' + with Timer() as t: + for i in range(100000): + i = i ** 20 + print t.elapsed_time() + assert t.elapsed_time() > 0 + +test_timer() \ No newline at end of file diff --git a/Students/Dave Fugelso/Session 9/timer.py b/Students/Dave Fugelso/Session 9/timer.py new file mode 100644 index 00000000..e703016e --- /dev/null +++ b/Students/Dave Fugelso/Session 9/timer.py @@ -0,0 +1,22 @@ +import time + +class Timer (object): + ''' + Context manager that prints elapsed time on exit. + ''' + def __init__(self): + print 'init' + pass + + + def __enter__(self): + print 'enter' + self.start = time.time() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + print 'Exit' + self.end = time.time() + + def elapsed_time (self): + return self.end - self.start