Commit 8a13c1a4 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

fixed broadcast mask for GET requests

parent 703582df
...@@ -808,6 +808,7 @@ function applyPost_debug($todo,$noFinalWait=false) { ...@@ -808,6 +808,7 @@ function applyPost_debug($todo,$noFinalWait=false) {
} }
} }
$broadcast_sorted=split_broadcast($pgmpars); $broadcast_sorted=split_broadcast($pgmpars);
ksort($broadcast_sorted); ksort($broadcast_sorted);
$frame_to_apply = $frame_zero+$since; $frame_to_apply = $frame_zero+$since;
if ($since<0){ if ($since<0){
...@@ -932,6 +933,7 @@ function split_broadcast($pgmpars){ ...@@ -932,6 +933,7 @@ function split_broadcast($pgmpars){
unset ($pgmpars[$name]); unset ($pgmpars[$name]);
} }
} }
$broadcast=array(0=>array()); $broadcast=array(0=>array());
foreach ($port_masks as $key=>$value){ foreach ($port_masks as $key=>$value){
// if (!in_array($value,$broadcast)) $broadcast[] = $value; // if (!in_array($value,$broadcast)) $broadcast[] = $value;
...@@ -960,34 +962,33 @@ function parsePost() { ...@@ -960,34 +962,33 @@ function parsePost() {
if (!$posted_params[$index]) $posted_params[$index]=array(); if (!$posted_params[$index]) $posted_params[$index]=array();
$posted_params[$index][$name]=$value; $posted_params[$index][$name]=$value;
} }
} }
// file_put_contents("/tmp/parse_post.log",print_r($_POST,1));
// file_put_contents("/tmp/posted_params.log",print_r($posted_params,1));
} }
/// Simulate POST from URL parameters if 'immediate' is present in the URL /// Simulate POST from URL parameters if 'immediate' is present in the URL
function convertImmediateMode(){ function convertImmediateMode(){
global $posted_params,$global_params,$frame_params; global $posted_params,$global_params,$frame_params;
$posted_params=array(); $posted_params=array();
$index=0; $index=0;
foreach ($global_params as $param) { foreach ($global_params as $param) {
$posted_params[$index++]=array( $posted_params[$index++]=array(
'name' => $param['name'], 'name' => $param['name'],
'oldval' => $param['cur_value'], 'oldval' => $param['cur_value'],
'paramdec' => $param['value'], /// 'paramhex' is not used 'paramdec' => $param['value'], /// 'paramhex' is not used
'delay'=> $param['ahead'], 'delay'=> $param['ahead'],
'apply' => $param['write_en'] && $param['modified'] 'broadcast'=> $param['port_mask'],
); 'apply' => $param['write_en'] && $param['modified']
} );
foreach ($frame_params as $param) { }
$posted_params[$index++]=array( foreach ($frame_params as $param) {
'name' => $param['name'], $posted_params[$index++]=array(
'oldval' => $param['cur_value'], 'name' => $param['name'],
'paramdec' => $param['value'], /// 'paramhex' is not used 'oldval' => $param['cur_value'],
'delay'=> $param['ahead'], 'paramdec' => $param['value'], /// 'paramhex' is not used
'apply' => $param['write_en'] && $param['modified'] 'delay'=> $param['ahead'],
); 'broadcast'=> $param['port_mask'],
} 'apply' => $param['write_en'] && $param['modified']
);
}
} }
function extractNames($arr){ function extractNames($arr){
$names=array(); $names=array();
...@@ -1094,7 +1095,8 @@ function parseGetNames() { ...@@ -1094,7 +1095,8 @@ function parseGetNames() {
if (!$embedImageScale) $embedImageScale=$defaultEmbedImageScale; if (!$embedImageScale) $embedImageScale=$defaultEmbedImageScale;
} else if ($key=='_time') { } else if ($key=='_time') {
} else if ($key=='sensor_port') { } else if ($key=='sensor_port') {
} else if ($key[0]=='*') {
} else { } else {
/// locate $key among constants, accept numeric values also /// locate $key among constants, accept numeric values also
$address=myval ($key); $address=myval ($key);
...@@ -1117,6 +1119,10 @@ function parseGetNames() { ...@@ -1117,6 +1119,10 @@ function parseGetNames() {
$value = substr($value,strpos($value,"!")+1); $value = substr($value,strpos($value,"!")+1);
} }
if (isset($_GET["*$key"])) {
$port_mask = myval($_GET["*$key"]);
}
$write_en=(!($value[0]=="@")); $write_en=(!($value[0]=="@"));
if (!$write_en) { if (!$write_en) {
if (strlen($value)==1) $value=""; if (strlen($value)==1) $value="";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment