my $nff = new NffInterface; #Initializes some variables and starts a software. my $logid = $nff->loadLog($inputFile); #$inputfile is the logfile. my $filter1={type => "logcode", logcode => 0x1069}; my $fid1=$nff->createFilter($logid,$filter1); #Picks an index in the log my $filter2={type => "logcode", logcode => 0x108A}; my $fid2=$nff->createFilter($logid,$filter2); my $view=$nff-> createView([$fid1,$fid2]); #Creates an array of multiple filters on order of the particular logId. my ($obj,$obj1,$obj2,$tmp,$myc2i,$codetype); $myc2i=0; do{ $tmp=$nff->getNextLogFromView($view); #Iterates on filter indices and gets the next log in the view array. if($tmp ne -1){ if(getLogCode($tmp) eq 0x108A){ $codetype="0x108A"; #print $codetype; $obj1 = parse108A($tmp); #Defined below. Parses 108A logs. my @pns = keys(%{$obj1->{sectors}}); for(my $i=0;$i<$obj1->{numSectors};$i++){ #for each sector my $sector = $pns[$i]; my $currentSectorPower=0; #compute the cumulative Received power for(my $j=0;$j<$obj1->{sectors}->{$sector}->{numFingers};$j++){ $currentSectorPower=$currentSectorPower+ $obj1->{sectors}->{$sector}->{$j}->{c2i}; } $obj->{sectors}->{$sector}->{cumulativePower}=$currentSectorPower; $myc2i=$obj->{sectors}->{$sector}->{cumulativePower}; #print $myc2i; if(getLogCode($tmp) eq 0x1069){ $codetype="0x1069"; #print $codetype; $obj2 = parse1069($tmp); #Defined below. Parses out 1069 logs. for (my $j=0;$j<2;$j++){ for my $rxAgc0(%{$obj->{$j}}) { print "$rxAgc0 = $obj2->{$j}{$rxAgc0}\n"; #print Dumper $obj2; } print "\n"; } } } } while($tmp ne -1); #### #0x1069 sub parse1069{ my $data=shift; my $len=length($data); my ($obj,$tmp,$j,$k); $obj->{timestamp}=getTimestamp($data); $len=$len-12; ($tmp,$data)=unpack("a12 a$len",$data); for($j=0;$j<2;$j++){ $len=$len-13; ($tmp, $obj->{$j}->{txOpenLoop},$obj->{$j}->{txClosedLoop},$obj->{$j}->{txPilot}, $obj->{$j}->{txTotal}, $obj->{$j}->{rxAgc0}, $obj->{$j}->{rxAgc1}, $data)=unpack("C v v v v v v a$len",$data); $obj->{$j}->{paState} = (int($tmp/32)) % 2; $obj->{$j}->{rachetMode} = (int($tmp/16)) % 2; if($obj->{$j}->{txOpenLoop} >= 2**15){ $obj->{$j}->{txOpenLoop} -= 2**16;} $obj->{$j}->{txOpenLoop} /= 256; if($obj->{$j}->{txClosedLoop} >= 2**15){ $obj->{$j}->{txClosedLoop} -= 2**16;} $obj->{$j}->{txClosedLoop} /= 256; if($obj->{$j}->{txPilot} >= 2**15){ $obj->{$j}->{txPilot} -= 2**16;} $obj->{$j}->{txPilot} /= 256; if($obj->{$j}->{txTotal} >= 2**15){ $obj->{$j}->{txTotal} -= 2**16;} $obj->{$j}->{txTotal} /= 256; if($obj->{$j}->{rxAgc0} >= 2**15){ $obj->{$j}->{rxAgc0} -= 2**16;} $obj->{$j}->{rxAgc0} /= 256; if($obj->{$j}->{rxAgc1} >= 2**15){ $obj->{$j}->{rxAgc1} -= 2**16;} $obj->{$j}->{rxAgc1} /= 256; } return $obj; } #### sub parse108A { my $data=shift; my $len=length($data); my ($obj,$tmp,$j,$k); $obj->{timestamp}=getTimestamp($data); $len=$len-12; ($tmp,$data)=unpack("a12 a$len",$data); my $fingId; $len = $len-10; ($obj->{srchState},$obj->{MSTR},$obj->{MSTRError},$obj->{MSTRPilotPN},$obj->{numF},$data)=unpack("C V v v C a$len",$data); my ($pilotPN,$rtcOffset,$c2i,$res1,$res2,$ant0c2i,$ant1c2i); $obj->{numSectors}=0; for($j=0;$j<$obj->{numF};$j++){ $len=$len-14; ($pilotPN,$rtcOffset,$c2i,$res1,$res2,$ant0c2i,$ant1c2i,$data) = unpack("v V v C C v v a$len",$data); if($pilotPN < 1024){ if(not defined($obj->{sectors}->{$pilotPN})){ $obj->{sectors}->{$pilotPN}->{numFingers}=0; $obj->{numSectors}++; } $fingId=$obj->{sectors}->{$pilotPN}->{numFingers}; $obj->{sectors}->{$pilotPN}->{$fingId}->{c2i} = $c2i; if($rtcOffset > 2**31-1){ $obj->{sectors}->{$pilotPN}->{$fingId}->{delay} = $rtcOffset-2**32; } else{ $obj->{sectors}->{$pilotPN}->{$fingId}->{delay} = $rtcOffset; } $obj->{sectors}->{$pilotPN}->{numFingers}++; } } return $obj; }