$sysTypeNo_0 = "111";
if($thisOmcType==10){
$sysTypeNo_1 = "251";
}else{
$sysTypeNo_1 = "322";
}
$db_0 = "OBJ_".$sysTypeNo_0;
$db_1 = "OBJ_".$sysTypeNo_1;
$tb_0 = "param_0";
$tb_1 = "param_1";
$tb_2 = "param_99";
$temTb = ${tb_.$sNum};
$subSysNo = floor($pNum/8);
if($DEBUG)echo "
subSysNo=$subSysNo";
$portNo = $pNum%8;
if($DEBUG)echo "
portNo=$portNo";
$tgTypeArr=array(
array('num' => '0', 'remark' => 'PSTN', 'color' => '#FF0000'),
array('num' => '1', 'remark' => 'HPLMN', 'color' => '#0000FF'),
array('num' => '2', 'remark' => 'VPLMN', 'color' => '#0000FF'),
array('num' => '3', 'remark' => 'SUB', 'color' => '#0000FF'),
array('num' => '4', 'remark' => 'IP', 'color' => '#0000FF'),
array('num' => '5', 'remark' => 'Intercept', 'color' => '#0000FF')
);
$netTypeArr=array(
array('num' => '0', 'remark' => 'International', 'color' => '#FF0000'),
array('num' => '1', 'remark' => 'Inter-S', 'color' => '#0000FF'),
array('num' => '2', 'remark' => 'National ', 'color' => '#0000FF'),
array('num' => '3', 'remark' => 'Na-S', 'color' => '#0000FF'),
array('num' => '4', 'remark' => '--', 'color' => '#0000FF')
);
$cirTypeArr=array(
array('num' => '0', 'remark' => 'Clockwise', 'color' => '#FF0000'),
array('num' => '1', 'remark' => 'Anti-C', 'color' => '#0000FF'),
array('num' => '2', 'remark' => 'Odd', 'color' => '#0000FF'),
array('num' => '3', 'remark' => 'Even', 'color' => '#0000FF'),
array('num' => '4', 'remark' => '--', 'color' => '#0000FF')
);
$tgLocationArr=array(
array('num' => '0', 'remark' => 'MSC-0', 'color' => '#FF0000'),
array('num' => '1', 'remark' => 'MSC-1', 'color' => '#0000FF'),
array('num' => '2', 'remark' => 'Both', 'color' => '#FF0000'),
array('num' => '3', 'remark' => 'Spare', 'color' => '#0000FF')
);
//Attributes of TG
$oidTg = "2.1.4";
$pTg = explode(".",$oidTg);
$i = 0;
$wTg = '';
while(isset($pTg[$i]))
{
$lNum = $i+1;
if($DEBUG) echo "
pTg[$i]=$pTg[$i]";
$wTg = $wTg." AND level_$lNum = $pTg[$i] ";
$i++;
}
if($set || $add)
{
if($DEBUG)echo "
dpc=$dpc";
$dpc = omc_keep_length($dpc,0,6);
$field_1 = "00".$dpc;
if($DEBUG)echo "
field_1=$field_1";
$hTgType = omc_keep_length(DecBin($tgType),0,3);
if($add){
$tgFlag = 1;
}
$field_2 = $lpFlag.$atFlag.$hTgType.$voFlag.$cdrFlag.$tgFlag;
$field_2 = omc_keep_length(DecHex(BinDec($field_2)),0,2);
if($DEBUG)echo "
field_2=$field_2";
$field_3 = omc_keep_length(DecHex($netType),0,2);
if($DEBUG)echo "
field_3=$field_3";
if($DEBUG)echo "
cirType=$cirType";
$hCirType = omc_keep_length(DecBin($cirType),0,2);
if($DEBUG)echo "
tgLct=$tgLct";
$htgLct = omc_keep_length(DecBin($tgLct),0,2);
if($DEBUG)echo "
backFlag=$backFlag";
$field_4 = $htgLct.$mptyFlag."00".$backFlag.$hCirType;
$field_4 = omc_keep_length(DecHex(BinDec($field_4)),0,2);
if($DEBUG)echo "
field_4=$field_4";
if($DEBUG)echo "
tgNum=$tgNum";
$field_5 = omc_keep_length(DecHex($tgNum),0,2);
if($DEBUG)echo "
field_5=$field_5";
if($DEBUG)echo "
tandemFlag=$tandemFlag";
$field_6 = omc_keep_length(DecHex($tandemFlag),0,2);
if($DEBUG)echo "
field_6=$field_6";
if($DEBUG)echo "
incomingCallType=$incomingCallType";
$field_7 = omc_keep_length(DecHex($incomingCallType),0,2);
if($DEBUG)echo "
field_7=$field_7";
$field_10=omc_keep_length(dechex(bindec($radioChannelControl.'00'.$halfRateSpeechV1.$halfRateSpeechV3.$fullRateSpeechV1.$fullRateSpeechV2.$fullRateSpeechV3)),0,2);
$field_11=omc_keep_length(dechex($sendST_digitFlag),0,2);
$field_12=omc_keep_length(dechex($ISUP_type),0,2);
$initValue = $field_1.$field_2.$field_3.$field_4.$field_5.$field_6.$field_7.$field_10.$field_11.$field_12;
$initValue = strtoupper($initValue);
if($DEBUG)echo "
initValue=$initValue";
$uTgSql = " UPDATE $tb_2 set initValue = '$initValue' WHERE subSysNo = '99' AND instanceNo = '$tNum' ".$wTg;
if($DEBUG)echo "
uTgSql=$uTgSql";
$uTgRes = @mysqli_query($pubConn,$uTgSql);
echo mysqli_error($pubConn);
echo "";
}
$tgSql = " SELECT instanceNo,initValue,editValue,readValue FROM $tb_2 WHERE subSysNo = '99' AND instanceNo = '$tNum' ".$wTg;
if($DEBUG) echo "
tgSql=$tgSql";
$tgRes = @mysqli_query($pubConn,$tgSql);
$tgRow = @mysqli_fetch_array($tgRes);
echo mysqli_error($pubConn);
$instanceNo = $tgRow[instanceNo];
$initValue = $tgRow[initValue];
if($DEBUG)echo "
initValue=$initValue";
$dpc = substr($initValue,2,6);
if($DEBUG)echo "
dpc=$dpc";
$hex_4 = substr($initValue,8,2);
if($DEBUG)echo "
hex_4=$hex_4";
$bin_4 = omc_keep_length(DecBin(HexDec($hex_4)),0,8);
if($DEBUG)echo "
bin_4=$bin_4";
$tgFlag = substr($bin_4,7,1);
if($DEBUG)echo "
tgFlag=$tgFlag";
$cdrFlag = substr($bin_4,6,1);
if($DEBUG)echo "
cdrFlag=$cdrFlag";
$voFlag = substr($bin_4,5,1);
if($DEBUG)echo "
voFlag=$voFlag";
$tgType = BinDec(substr($bin_4,2,3));
if($DEBUG)echo "
tgType=$tgType";
$atFlag = substr($bin_4,1,1);
if($DEBUG)echo "
atFlag=$atFlag";
$lpFlag = substr($bin_4,0,1);
$netType = HexDec(substr($initValue,10,2));
if($DEBUG)echo "
netType=$netType";
$hex_6 = substr($initValue,12,2);
if($DEBUG)echo "
hex_6=$hex_6";
$bin_6 = omc_keep_length(DecBin(HexDec($hex_6)),0,8);
if($DEBUG)echo "
bin_6=$bin_6";
$cirType = BinDec(substr($bin_6,6,2));
if($DEBUG)echo "
cirType=$cirType";
$backFlag = substr($bin_6,5,1);
if($DEBUG)echo "
backFlag=$backFlag";
$tgLct = BinDec(substr($bin_6,0,2));
if($DEBUG)echo "
tgArr[$instanceNo][11]={$tgArr[$instanceNo][11]}";
$mptyFlag = BinDec(substr($bin_6,2,1));
if($DEBUG)echo "
mptyFlag=$mptyFlag";
$hex_8 = substr($initValue,16,2);
if($DEBUG)echo "
hex_8=$hex_8";
$tandemFlag = hexdec($hex_8);
if($DEBUG)echo "
tandemFlag=$tandemFlag";
$tgNum = HexDec(substr($initValue,14,2));
if($DEBUG)echo "
tgNum=$tgNum";
$incomingCallType=HexDec(substr($initValue,18,2));
if($DEBUG)echo "
incomingCallType=$incomingCallType";
$hex_10=substr($initValue,20,2);
if($DEBUG)echo "
hex_10=$hex_10";
$bin_10=omc_keep_length(DecBin(HexDec($hex_10)),0,8);
if($DEBUG)echo "
bin_10=$bin_10";
$radioChannelControl=substr($bin_10,0,1);
if($DEBUG)echo "
radioChannelControl=$radioChannelControl";
$halfRateSpeechV1=substr($bin_10,3,1);
if($DEBUG)echo "
halfRateSpeechV1=$halfRateSpeechV1";
$halfRateSpeechV3=substr($bin_10,4,1);
if($DEBUG)echo "
halfRateSpeechV3=$halfRateSpeechV3";
$fullRateSpeechV1=substr($bin_10,5,1);
if($DEBUG)echo "
fullRateSpeechV1=$fullRateSpeechV1";
$fullRateSpeechV2=substr($bin_10,6,1);
if($DEBUG)echo "
fullRateSpeechV2=$fullRateSpeechV2";
$fullRateSpeechV3=substr($bin_10,7,1);
if($DEBUG)echo "
fullRateSpeechV3=$fullRateSpeechV3";
$sendST_digitFlag=HexDec(substr($initValue,22,2));
if($DEBUG)echo "
sendST_digitFlag=$sendST_digitFlag";
$ISUP_type=HexDec(substr($initValue,24,2));
if($DEBUG)echo "
ISUP_type=$ISUP_type";
//$hiddenValue=substr($initValue,20,6);
//if($DEBUG)echo "
hiddenValue=$hiddenValue";
echo "