www-thermferm/index.php

changeset 219
ae720212accc
parent 210
8976069c6b29
child 251
173b4480c4a0
equal deleted inserted replaced
218:311a293b3e46 219:ae720212accc
168 } 168 }
169 169
170 170
171 if (isset($_POST['SetProfile']) && isset($_POST['key']) && isset($_POST['UUID'])) { 171 if (isset($_POST['SetProfile']) && isset($_POST['key']) && isset($_POST['UUID'])) {
172 172
173 if ($_POST['key'] == "Set") { 173 $sock = open_socket();
174 $sock = open_socket(); 174 if ($sock != false) {
175 if ($sock != false) { 175 socket_write($sock, 'UNIT PUT '.$_POST['UUID'], 4096);
176 socket_write($sock, 'UNIT PUT '.$_POST['UUID'], 4096); 176 usleep(20000);
177 usleep(20000); 177 if ($_POST['key'] == "Set")
178 socket_write($sock, 'PROFILE,'.$_POST['SetProfile'], 4096); 178 socket_write($sock, 'PROFILE,'.$_POST['SetProfile'], 4096);
179 usleep(20000); 179 else if ($_POST['key'] == "Start")
180 socket_write($sock, '.', 4096); 180 socket_write($sock, 'PROF_STATE,RUN', 4096);
181 /* Absorb response */ 181 else if (($_POST['key'] == "Pause") || ($_POST['key'] == "Resume"))
182 while (1) { 182 socket_write($sock, 'PROF_STATE,PAUSE', 4096);
183 else if ($_POST['key'] == "Abort")
184 socket_write($sock, 'PROF_STATE,ABORT', 4096);
185 else if ($_POST['key'] == "Off")
186 socket_write($sock, 'PROF_STATE,OFF', 4096);
187 usleep(20000);
188 socket_write($sock, '.', 4096);
189 /* Absorb response */
190 while (1) {
183 $line = socket_read($sock, 4096); 191 $line = socket_read($sock, 4096);
184 if ($line === '') 192 if ($line === '')
185 break; 193 break;
186 } 194 }
187 socket_close($sock); 195 socket_close($sock);
188 } 196 }
189 } 197
190 unset($_POST['SetProfile']); 198 unset($_POST['SetProfile']);
191 unset($_POST['key']); 199 unset($_POST['key']);
192 unset($_POST['UUID']); 200 unset($_POST['UUID']);
193 } 201 }
194 202

mercurial