init:$initByteValue
read:$readByteValue"; $readBitValue = ''; if($bgnBit > 0 ||$endBit < 7) { $bitLen = $byteLen*8;//1 byte = 8 bit $readBitValue = DecBin(HexDec($readByteValue)); $readBitValue = omcStrFill($readBitValue,$bitLen,'high','0'); $newBitValue=''; for($byteNum=$bgnByte;$byteNum<=$endByte;$byteNum++){ $tmpBitValue=substr($readBitValue,($byteNum-$bgnByte)*8,8); if($DEBUG) echo "
$tmpBitValue=substr($readBitValue,($byteNum-$bgnByte)*8,8)"; $tmpBitValue = strrev($tmpBitValue); if($DEBUG) echo "
$tmpBitValue = strrev($tmpBitValue)"; if($DEBUG) echo "
bitValue = $bitValue"; $newBitValue=$newBitValue.$tmpBitValue; } $catBitLen = $endByte*8+$endBit - ($bgnByte*8+$bgnBit) + 1; //1 byte = 8 bit if($DEBUG) echo "
readBitValue = substr($newBitValue,$bgnBit,$catBitLen)"; $readBitValue = substr($newBitValue,$bgnBit,$catBitLen); $readBitValue = strrev($readBitValue); if($DEBUG) echo "
readBitValue = $readBitValue"; } $initBitValue = ''; if($bgnBit > 0 ||$endBit < 7) { $bitLen = $byteLen*8;//1 byte = 8 bit $initBitValue = DecBin(HexDec($initByteValue)); $initBitValue = omcStrFill($initBitValue,$bitLen,'high','0'); $newBitValue=''; for($byteNum=$bgnByte;$byteNum<=$endByte;$byteNum++){ $tmpBitValue=substr($initBitValue,($byteNum-$bgnByte)*8,8); if($DEBUG) echo "
$tmpBitValue=substr($initBitValue,($byteNum-$bgnByte)*8,8)"; $tmpBitValue = strrev($tmpBitValue); if($DEBUG) echo "
$tmpBitValue = strrev($tmpBitValue)"; if($DEBUG) echo "
bitValue = $bitValue"; $newBitValue=$newBitValue.$tmpBitValue; } $catBitLen = $endByte*8+$endBit - ($bgnByte*8+$bgnBit) + 1; //1 byte = 8 bit if($DEBUG) echo "
initBitValue = substr($newBitValue,$bgnBit,$catBitLen)"; $initBitValue = substr($newBitValue,$bgnBit,$catBitLen); $initBitValue = strrev($initBitValue); if($DEBUG) echo "
initBitValue = $initBitValue"; } $IniEquRead = false; if(strlen($initBitValue)>0) { if($initBitValue==$readBitValue) $IniEquRead = true; } else { if($initByteValue == $readByteValue) $IniEquRead = true; } //explode by '[v]' $valueArr = explode('[v]',$tlvArr[2]); $typeAddTitleArr = explode('[t]',$valueArr[0]); $operType = chop($typeAddTitleArr[0]); $titleStr = chop($typeAddTitleArr[1]); $valueArr[1] = chop($valueArr[1]); if($DEBUG) echo "
operType = $operType"; switch($operType) { case 'input': { //explode by '-' $defArr = explode('-',$valueArr[1]); if($DEBUG) echo "
defArr = $defArr[0],$defArr[1],$defArr[2]"; switch($defArr[0]) { case 'toDec': if(strlen($initBitValue) > 0){ $initParsedValue = BinDec($initBitValue); }else{ $initParsedValue = HexDec($initByteValue); } break; case 'keepDec': $initParsedValue = $initByteValue; break; case 'toHex': echo "
Error:toHex"; break; case 'keepHex': $initParsedValue = $initByteValue; break; case 'toAscii': $charValue = ""; if($bgnBit > 0 ||$endBit < 7) { echo "
Error:toAscii"; exit(1); } else { $tmpLen=strlen($initByteValue); for($charCount=0;$charCount<$tmpLen;$charCount++) { $unitByte = substr($initByteValue,$charCount,2); $unitChar = chr(HexDec($unitByte)); // hex -> ascii if($DEBUG) echo "
unitChar=$unitChar"; $charValue .= $unitChar; $charCount++; } $charValue = trim($charValue); $initParsedValue = $charValue; } break; default: echo "
Error:valueType=$defArr[0]"; break; } if($DEBUG) echo "
initParsedValue = $initParsedValue"; switch($defArr[1]) { case 'high': switch($defArr[2]) { case '0': if($defArr[0] == 'toHex' || $defArr[0] == 'keepHex'){ //$initParsedValue = str_replace('0','',$initParsedValue); }else{ $initParsedValue = $initParsedValue - 0; } break; case 'E': echo "Error:high fill E"; break; default: break; } break; case 'low': if ("toAscii" != $defArr[0]) { switch($defArr[2]){ case '0': $initParsedValue = str_replace('00','',$initParsedValue); break; case 'E': $initParsedValue = str_replace('E','',$initParsedValue); break; case 'F': //modify zane 20051004 $initParsedValue = str_replace('F','',$initParsedValue); break; default: break; } } break; default: break; } $returnValue = $initParsedValue; break; } case 'select': { if($valueType == $nOctStr){ if($initBitValue != ''){ $selectValue = BinDec($initBitValue); }else{ $selectValue = HexDec($initByteValue); } }else{ $selectValue=$initByteValue; } $isSelected = 0; for($j=1;$j$defArr[1]"; } } if($isSelected ==0 && $j == sizeof($valueArr)){ $selectShow = "Undefined Value"; } $returnValue = $selectShow; break; } default: echo "
Error:operType =|$operType|"; break; }//end of switch(..) if(strlen($returnValue)==0) $returnValue='--'; return $returnValue; }//end getParamValue function showParameter($sysId,$oidStr,$order,$inputValueType,$instanceNo=0,$doingOtherUlr='',$otherWhereStr='',$showStr='') { global $language,$notSettedColor,$settedColor; $tmp1 = str_replace('.','_',$oidStr); $id = 'ID_' . $sysId . '_' . $tmp1 . '_' . $order . '_ist' . $instanceNo; $newId = "New".$id; $showValue = getParamValue($titleStr,$IniEquRead,$sysId,$oidStr,$order,$instanceNo,$otherWhereStr); if($IniEquRead)$color = $settedColor; else $color = $notSettedColor; $doingOtherUlr=urlencode($doingOtherUlr); if(strlen($showStr)) { $color = $settedColor; $showValue = $showStr; } //$otherWhereStr=urlencode($otherWhereStr); echo "$showValue"; echo ""; } ?>