← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~alisonken1/openlp/bug-1550891 into lp:openlp

 

Ken Roberts has proposed merging lp:~alisonken1/openlp/bug-1550891 into lp:openlp.

Commit message:
Fix Projector Manager receiving non-PJLink reply to initial class query and encoding exception when sending data

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1550891 in OpenLP: "Projector manager rejecting replies as invalid"
  https://bugs.launchpad.net/openlp/+bug/1550891

For more details, see:
https://code.launchpad.net/~alisonken1/openlp/bug-1550891/+merge/287407

- Fix projector manager receiving an invalid class response on initial connection
- Fix string encoding to ascii when sending request to projector

--------------------------------
lp:~alisonken1/openlp/bug-1550891 (revision 2624)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1301/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1223/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1162/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/997/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/588/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/654/
[FAILURE] https://ci.openlp.io/job/Branch-05b-Test_Coverage/523/
Stopping after failure

-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~alisonken1/openlp/bug-1550891 into lp:openlp.
=== modified file 'openlp/core/lib/projector/pjlink1.py'
--- openlp/core/lib/projector/pjlink1.py	2016-01-09 16:59:42 +0000
+++ openlp/core/lib/projector/pjlink1.py	2016-02-28 12:59:15 +0000
@@ -515,7 +515,7 @@
         self.socket_timer.start()
         try:
             self.projectorNetwork.emit(S_NETWORK_SENDING)
-            sent = self.write(out)
+            sent = self.write(out.encode('ascii'))
             self.waitForBytesWritten(2000)  # 2 seconds should be enough
             if sent == -1:
                 # Network error?
@@ -665,7 +665,15 @@
 
         :param data: Class that projector supports.
         """
-        self.pjlink_class = data
+        # bug 1550891: Projector returns non-standard class response:
+        #            : Expected: %1CLSS=1
+        #            : Received: %1CLSS=Class 1
+        if len(data) > 1:
+            # Split non-standard information from response
+            clss = data.split()[-1]
+        else:
+            clss = data
+        self.pjlink_class = clss
         log.debug('(%s) Setting pjlink_class for this projector to "%s"' % (self.ip, self.pjlink_class))
         return
 

=== modified file 'tests/functional/openlp_core_lib/test_projector_pjlink1.py'
--- tests/functional/openlp_core_lib/test_projector_pjlink1.py	2016-01-10 22:10:50 +0000
+++ tests/functional/openlp_core_lib/test_projector_pjlink1.py	2016-02-28 12:59:15 +0000
@@ -60,3 +60,17 @@
                                                    "Connection request should have been called with TEST_SALT"))
         self.assertTrue(mock_qmd5_hash.called_with(TEST_PIN,
                                                    "Connection request should have been called with TEST_PIN"))
+
+    def non_standard_class_reply_test(self):
+        """
+        bugfix 1550891 - CLSS request returns non-standard 'Class N' reply
+        """
+        # GIVEN: Test object
+        pjlink = pjlink_test
+
+        # WHEN: Process non-standard reply
+        pjlink.process_clss('Class 1')
+
+        # THEN: Projector class should be set with proper value
+        self.assertEquals(pjlink.pjlink_class, '1',
+                          'Non-standard class reply should have set proper class')


Follow ups