$v){ $form[$d] = isset($_REQUEST[$d]) ? $_REQUEST[$d] : $v; } // make javascript types objects ----------------------------------- $mys= new MySensors(); $mess_types=$mys->getMessageTypes(); $sub_types=$mys->getSubTypes(); $js_types .="var types ={};\n"; $js_types .="var mess_types=[];\n"; foreach($mess_types as $t_name => $t){ $js_types .="mess_types[$t]= '$t_name';\n"; $js_types .="types.$t_name= [];\n"; $ts=''; if($t==$form['type']){$ts=" selected='selected'";} $html_options_mess .=" \n"; foreach($sub_types[$t] as $code => $n){ $js_types.="types.{$t_name}[{$n}] = '$code';\n"; } } // process the form ------------------------------------------------- if($_REQUEST['do']){ if($gateway=='serial'){ $mys=new MySensorSendSerial($form['s_port']); } else{ $mys=new MySensorSendEthernet($form['ip'],$form['port']); } $result=$mys->sendMessage($form['node'],$form['child'],$form['type'],$form['ack'],$form['sub'],$form['payload'],$form['wait']); if($result){ $class='success'; if($form['wait']){ $err_mess="Received : $result"; } else{ $err_mess="Successfull!"; } } else{ $class='danger'; if($form['wait']){ $err_mess="Did not receive an answer!"; } else{ $err_mess="Something went wrong. Check GW is receiving on {$form['ip']}:{$form['port']} ! "; } } $last_mess = "
  • Query   : ".$mys->GetRawMessage()."
  • \n" ; if($form['wait']){ $last_mess .= "
  • Answer : ".$mys->GetRawAnswer()."
  • \n" ; } $date=date('l, H\h i\m s\s'); $html_result=<<

    $err_mess



    Message sent to gateway {$form['ip']}:{$form['port']} on $date EOF; } // build ack menu -------------------------------------------------------------- for($i=0;$i<=1;$i++){ $html_options_ack .="