@@ -167,16 +167,16 @@ |
||
| 167 | 167 | $this->_deviceId = $device->MyQDeviceId; |
| 168 | 168 | foreach ($device->Attributes as $attr) { |
| 169 | 169 | switch ($attr->AttributeDisplayName) { |
| 170 | - case 'desc': |
|
| 171 | - $this->_doorName = $attr->Value; |
|
| 172 | - break; |
|
| 173 | - case 'doorstate': |
|
| 174 | - $this->_doorState = $attr->Value; |
|
| 175 | - // UpdatedTime is a timestamp in ms, so we truncate |
|
| 176 | - $this->_doorStateTime = (int)$attr->UpdatedTime / 1000; |
|
| 177 | - break; |
|
| 178 | - default: |
|
| 179 | - continue; |
|
| 170 | + case 'desc': |
|
| 171 | + $this->_doorName = $attr->Value; |
|
| 172 | + break; |
|
| 173 | + case 'doorstate': |
|
| 174 | + $this->_doorState = $attr->Value; |
|
| 175 | + // UpdatedTime is a timestamp in ms, so we truncate |
|
| 176 | + $this->_doorStateTime = (int)$attr->UpdatedTime / 1000; |
|
| 177 | + break; |
|
| 178 | + default: |
|
| 179 | + continue; |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -77,62 +77,62 @@ |
||
| 77 | 77 | |
| 78 | 78 | if ($mode!='daily') { |
| 79 | 79 | switch ($mode) { |
| 80 | - case 'weekly': |
|
| 81 | - if (isset($rows[11])) { |
|
| 82 | - if (AddressBookLocation::validateScheduleWeekDays($rows[11])) { |
|
| 83 | - $schedule.='"weekdays":['.$rows[11].']}'; |
|
| 84 | - } |
|
| 85 | - else {echo "$iRow --> Wrong weekdays <br>";$schedule="";} |
|
| 80 | + case 'weekly': |
|
| 81 | + if (isset($rows[11])) { |
|
| 82 | + if (AddressBookLocation::validateScheduleWeekDays($rows[11])) { |
|
| 83 | + $schedule.='"weekdays":['.$rows[11].']}'; |
|
| 86 | 84 | } |
| 87 | - else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";} |
|
| 88 | - break; |
|
| 89 | - case 'monthly': |
|
| 90 | - $monthlyMode=""; |
|
| 91 | - if (isset($rows[12])) { |
|
| 92 | - if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) { |
|
| 93 | - $monthlyMode=$rows[12]; |
|
| 94 | - $schedule.='"mode": "'.$rows[12].'",'; |
|
| 95 | - } |
|
| 96 | - else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";} |
|
| 85 | + else {echo "$iRow --> Wrong weekdays <br>";$schedule="";} |
|
| 86 | + } |
|
| 87 | + else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";} |
|
| 88 | + break; |
|
| 89 | + case 'monthly': |
|
| 90 | + $monthlyMode=""; |
|
| 91 | + if (isset($rows[12])) { |
|
| 92 | + if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) { |
|
| 93 | + $monthlyMode=$rows[12]; |
|
| 94 | + $schedule.='"mode": "'.$rows[12].'",'; |
|
| 97 | 95 | } |
| 98 | - else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";} |
|
| 96 | + else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";} |
|
| 97 | + } |
|
| 98 | + else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";} |
|
| 99 | 99 | |
| 100 | - if ($monthlyMode!="") { |
|
| 101 | - switch ($monthlyMode) { |
|
| 102 | - case 'dates': |
|
| 103 | - if (isset($rows[13])) { |
|
| 104 | - if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) { |
|
| 105 | - $schedule.='"dates":['.$rows[13].']}'; |
|
| 106 | - } |
|
| 107 | - else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";} |
|
| 108 | - } |
|
| 109 | - break; |
|
| 110 | - case 'nth': |
|
| 111 | - if (isset($rows[16])) { |
|
| 112 | - if (AddressBookLocation::validateScheduleNthN($rows[16])) { |
|
| 113 | - $schedule.='"nth":{"n":'.$rows[16].','; |
|
| 114 | - } |
|
| 115 | - else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";} |
|
| 116 | - } |
|
| 117 | - else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";} |
|
| 118 | - |
|
| 119 | - if ($schedule!="") { |
|
| 120 | - if (isset($rows[17])) { |
|
| 121 | - if (AddressBookLocation::validateScheduleNthWhat($rows[17])) { |
|
| 122 | - $schedule.='"what":'.$rows[17].'}}'; |
|
| 123 | - } |
|
| 124 | - else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";} |
|
| 125 | - } |
|
| 126 | - else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";} |
|
| 127 | - } |
|
| 100 | + if ($monthlyMode!="") { |
|
| 101 | + switch ($monthlyMode) { |
|
| 102 | + case 'dates': |
|
| 103 | + if (isset($rows[13])) { |
|
| 104 | + if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) { |
|
| 105 | + $schedule.='"dates":['.$rows[13].']}'; |
|
| 106 | + } |
|
| 107 | + else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";} |
|
| 108 | + } |
|
| 109 | + break; |
|
| 110 | + case 'nth': |
|
| 111 | + if (isset($rows[16])) { |
|
| 112 | + if (AddressBookLocation::validateScheduleNthN($rows[16])) { |
|
| 113 | + $schedule.='"nth":{"n":'.$rows[16].','; |
|
| 114 | + } |
|
| 115 | + else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";} |
|
| 116 | + } |
|
| 117 | + else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";} |
|
| 128 | 118 | |
| 129 | - break; |
|
| 119 | + if ($schedule!="") { |
|
| 120 | + if (isset($rows[17])) { |
|
| 121 | + if (AddressBookLocation::validateScheduleNthWhat($rows[17])) { |
|
| 122 | + $schedule.='"what":'.$rows[17].'}}'; |
|
| 130 | 123 | } |
| 124 | + else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";} |
|
| 125 | + } |
|
| 126 | + else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";} |
|
| 131 | 127 | } |
| 128 | + |
|
| 132 | 129 | break; |
| 133 | - default: |
|
| 134 | - $schedule==""; |
|
| 130 | + } |
|
| 131 | + } |
|
| 135 | 132 | break; |
| 133 | + default: |
|
| 134 | + $schedule==""; |
|
| 135 | + break; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | } |