Writing Your Own Analyzers

MobieInsight analyzers are designed to be extensible. You can define your own analyzers for customized analysis. Your customized analyzers can be built on top of existing analyzers, which can help reduce the development complexity.

As a example, consider writing a RRC (radio resource control) analyzer. Different from 3G/4G-only RRC analyzer, the purpose of this RRC analyzer is to offer a unified analysis for RRC, no matter whether the phone is in 3G or 4G. To achieve it, this analyzer is built on top of existing 4G LteRrcAnalyzer and 3G WcdmaRrcAnalyzer. The following code shows part of this implementation (the complete code can be found here ):

from analyzer import *

class RrcAnalyzer(Analyzer):
        def __init__(self):
                Analyzer.__init__(self)
                #include analyzers

                self.include_analyzer("LteRrcAnalyzer",[self.__on_event])
                self.include_analyzer("WcdmaRrcAnalyzer",[self.__on_event])

                #init packet filters
                self.add_source_callback(self.__rrc_filter)

        def __rrc_filter(self,msg):
                """callbacks for the 3G/4G RRC messages"""
                #...

In above example, we declare the dependency of LteRrcAnalyzer and WcdmaRrcAnalyzer in the initialization, and defines customized callback functions the react to the 3G/4G RRC messages and/or LteRrcAnalyzer/WcdmaRrcAnalyzer’s events.