Exemplo n.º 1
0
    def OnbtnOk(self, event):
        reqAb = ReqAbFreq()
        reqAb.CommonHeader = FrameHeader(0x55, 0xA4, self.lowid, self.highid)
        reqAb.CommonTail = self.tail
        if (self.radioBox.GetSelection()):
            reqAb.LocateWay = 0x0F
        centreFreq = float(self.CentreFreq.GetValue())
        bandWidth = int(self.BandWidth.GetSelection()) + 1
        centreFreq_I = int(centreFreq)
        centreFreq_F = int((centreFreq - int(centreFreq)) * 2**10)
        reqAb.Param.HighCentreFreqInteger = centreFreq_I >> 6
        reqAb.Param.LowCentreFreqInteger = centreFreq_I & 0x003F
        reqAb.Param.HighCentreFreqFraction = centreFreq_F >> 8
        reqAb.Param.LowCentreFreqFraction = centreFreq_F & 0x0FF
        reqAb.Param.UploadNum = int(self.UploadNum.GetValue())
        reqAb.Param.DataRate = bandWidth
        reqAb.Param.BandWidth = bandWidth

        startTime=(int(self.StartTimeYear.GetValue()),int(self.StartTimeMonth.GetValue()),  \
                   int(self.StartTimeDay.GetValue()),int(self.StartTimeHour.GetValue()),    \
                   int(self.StartTimeMinute.GetValue()),int(self.StartTimeSecond.GetValue()))

        reqAb.Time.HighYear = startTime[0] >> 4
        reqAb.Time.LowYear = startTime[0] & 0x00F
        reqAb.Time.Month = startTime[1]
        reqAb.Time.Day = startTime[2]
        reqAb.Time.HighHour = startTime[3] >> 2
        reqAb.Time.LowHour = startTime[3] & 0x03
        reqAb.Time.Minute = startTime[4]
        reqAb.Time.Second = startTime[5]

        if (staticVar.getSock()):
            staticVar.getSock().sendall(bytearray(reqAb))

        self.Destroy()
Exemplo n.º 2
0
    def HistoryDataQuery(self, functionPara):
        Obj = ReqData()

        startTime = (int(self.StartTimeYear.GetValue()),
                     int(self.StartTimeMonth.GetValue()),
                     int(self.StartTimeDay.GetValue()),
                     int(self.StartTimeHour.GetValue()),
                     int(self.StartTimeMinute.GetValue()))
        endTime = (int(self.EndTimeYear.GetValue()),
                   int(self.EndTimeMonth.GetValue()),
                   int(self.EndTimeDay.GetValue()),
                   int(self.EndTimeHour.GetValue()),
                   int(self.EndTimeMinute.GetValue()))
        apointID = int(self.ApointID.GetValue())

        Obj.CommonHeader = FrameHeader(0x55, functionPara,
                                       staticVar.getid() & 0x00FF,
                                       staticVar.getid() >> 8)
        Obj.CommonTail = FrameTail(0, 0, 0xAA)
        Obj.ApointID_h = apointID >> 8
        Obj.ApointID_l = apointID & 0x00FF
        Obj.StartTime = self.ByteToTime(startTime)
        Obj.EndTime = self.ByteToTime(endTime)

        if (staticVar.getSock()):
            staticVar.getSock().sendall(bytearray(Obj))
Exemplo n.º 3
0
    def SetCorrGain(self, func):
        if (staticVar.getSock() == 0):
            wx.MessageBox('Please Connect to Server!!', 'Alert',
                          wx.ICON_INFORMATION | wx.STAY_ON_TOP)
        else:

            head = FrameHeader(0x55, func, self.lowid, self.highid)
            tail = self.tail
            encode = self.m_combo_channelgain.GetSelection() + 1
            gainTable = ReqGainTable(head, encode >> 8, encode & 0x00FF, tail)

            staticVar.getSock().send(gainTable)
Exemplo n.º 4
0
 def SetCorrGain(self,func):
     if(staticVar.getSock()==0):
         wx.MessageBox('Please Connect to Server!!', 
                'Alert', wx.ICON_INFORMATION | wx.STAY_ON_TOP)
     else:
         
         head=FrameHeader(0x55,func,self.lowid,self.highid)
         tail=self.tail
         encode=self.m_combo_channelgain.GetSelection()+1
         gainTable=ReqGainTable(head,encode>>8,encode&0x00FF,tail)
     
         staticVar.getSock().send(gainTable)
 def query_port(cls,func):
     id_for=staticVar.getid()
     lowid=id_for&0x00FF
     highid=id_for>>8
 
     query=Query()
     query.CommonHeader=FrameHeader(0x55,func,lowid,highid)
     query.CommonTail=cls.tail
     for i in bytearray(query):
         print i,
          
     staticVar.getSock().sendall(bytearray(query))
    def query_port(cls, func):
        id_for = staticVar.getid()
        lowid = id_for & 0x00FF
        highid = id_for >> 8

        query = Query()
        query.CommonHeader = FrameHeader(0x55, func, lowid, highid)
        query.CommonTail = cls.tail
        for i in bytearray(query):
            print i,

        staticVar.getSock().sendall(bytearray(query))
Exemplo n.º 7
0
 def run(self):
     while(1):
         print 'send heart_beat'
         staticVar.getSock().sendall(struct.pack("!B",0x55)) 
         staticVar.getSock().sendall(struct.pack("!B",0x66)) 
         time.sleep(15)
         
         if(staticVar.count_heat_beat>self.count_heart):
             self.count_heart+=1
             
             if(self.count_heart>10000):
                 self.count_heart=0
             staticVar.count_heat_beat=self.count_heart
         else:
             print 'not receive heart_beat'
             self.reConnect()
    def OnbtnOk(self, event):
        freqStart = int(self.FreqStart.GetValue())
        freqEnd = int(self.FreqEnd.GetValue())
        stationPro = QueryStationPro()
        stationPro.CommonHeader = FrameHeader(0x55, self.func, self.lowid,
                                              self.highid)
        stationPro.CommonTail = self.tail
        stationPro.HighFreqStart = freqStart >> 8
        stationPro.LowFreqStart = freqStart & 0x00FF
        stationPro.HighFreqEnd = freqEnd >> 8
        stationPro.LowFreqEnd = freqEnd & 0x00FF

        if (staticVar.getSock()):
            staticVar.getSock().sendall(bytearray(stationPro))

        self.Destroy()
Exemplo n.º 9
0
    def run(self):
        while (1):
            print 'send heart_beat'
            staticVar.getSock().sendall(struct.pack("!B", 0x55))
            staticVar.getSock().sendall(struct.pack("!B", 0x66))
            time.sleep(15)

            if (staticVar.count_heat_beat > self.count_heart):
                self.count_heart += 1

                if (self.count_heart > 10000):
                    self.count_heart = 0
                staticVar.count_heat_beat = self.count_heart
            else:
                print 'not receive heart_beat'
                self.reConnect()
    def OnbtnOk(self,event):
        freqStart=int(self.FreqStart.GetValue())
        freqEnd=int(self.FreqEnd.GetValue())
        stationPro=QueryStationPro()
        stationPro.CommonHeader=FrameHeader(0x55,self.func,self.lowid,self.highid)
        stationPro.CommonTail=self.tail
        stationPro.HighFreqStart=freqStart>>8
        stationPro.LowFreqStart=freqStart&0x00FF
        stationPro.HighFreqEnd=freqEnd>>8
        stationPro.LowFreqEnd=freqEnd&0x00FF


        if(staticVar.getSock()):
            staticVar.getSock().sendall(bytearray(stationPro))
            
        self.Destroy()
    def __init__(self,mainframe): 
        threading.Thread.__init__(self)
        
        self.dictFreqPlan=staticVar.getdictFreqPlan()
        self.event = threading.Event()
        self.event.set()
        self.sock=staticVar.getSock()
        self.sockFile=staticVar.getSockFile()
        self.outPoint=staticVar.outPoint
        self.specFrame=mainframe.SpecFrame
        self.specFrame.iq_sequence=0

        self.mainframe=mainframe

        self.thread_tdoa=0

        '''这里是四个发送文件的class'''
        self.send_file_class=class_upload.SendFileClass(self.specFrame,self.mainframe.queueFFTUpload,
                                                        self.mainframe.queueAbUpload)

        self.send_file_iq_class=class_upload_iq.SendIQFile(self.mainframe)

        self.send_file_poa_class=class_upload_poa.SendPoaFile()

        self.send_file_tdoa_class=class_upload_tdoa.SendTdoaFile()

        self.count_heart_beat=0
        self.thread_timer=0
        self.thread_timer=0
        '''0:spec   1:iq    2: POA  3: TDOA  文件上传'''
        self.switch_to_transfer=0

        self.rlist=[self.sock,self.sockFile]
        self.wlist=[self.sock,self.sockFile]
        self.xlist=[self.sock,self.sockFile]
Exemplo n.º 12
0
    def OnbtnOk(self, event):

        if (self.radioBox1.GetSelection()):
            reqElec = ReqElecPath()
            reqElec.CommonHeader = FrameHeader(0x55, 0xA3, self.lowid,
                                               self.highid)
            reqElec.CommonTail = self.tail

            reqElec.DataSource = 15

            if (self.radioBox3.GetSelection() == 0):
                centreFreq = self.ListFreq[self.FreqSection.GetSelection()][0]
                bandWidth = self.ListFreq[self.FreqSection.GetSelection()][1]
            else:
                centreFreq = int(self.CentreFreq.GetValue())
                bandWidth = int(self.BandWidth.GetValue())

            if (self.radioBox4.GetSelection() == 0):
                reqElec.TPOA = 0xFF

            reqElec.HighCentreFreq = centreFreq >> 8
            reqElec.LowCentreFreq = centreFreq & 0x00FF
            reqElec.BandWidth = bandWidth

            startTime=(int(self.StartTimeYear.GetValue()),int(self.StartTimeMonth.GetValue()),  \
                       int(self.StartTimeDay.GetValue()),int(self.StartTimeHour.GetValue()),    \
                       int(self.StartTimeMinute.GetValue())
                       )
            endTime=(int(self.EndTimeYear.GetValue()),int(self.EndTimeMonth.GetValue()),  \
                       int(self.EndTimeDay.GetValue()),int(self.EndTimeHour.GetValue()),    \
                       int(self.EndTimeMinute.GetValue())
                       )

            reqElec.StartTime = self.ByteToTime(startTime)
            reqElec.EndTime = self.ByteToTime(endTime)

            if (staticVar.getSock()):
                staticVar.getSock().sendall(bytearray(reqElec))

        else:
            if (self.parent.thread_route_map == 0):
                self.parent.thread_route_map = InsertRouteThread(self.parent)
                self.parent.thread_route_map.start()
            else:
                self.parent.thread_route_map.event.set()

        self.Destroy()
Exemplo n.º 13
0
  def reConnect(self):
      '''stop all thread related to sock '''
      self.thread_upload.stop()
      self.thread_station.stop()
      
      
      staticVar.getSock().close()
      staticVar.getSockFile().close()
      
      self.thread_station.input1=[]
      staticVar.sock=0
      staticVar.sockFile=0
      
      serverCom=ServerCommunication() #实例化服务器连接对象
      while(1):
          try:
              serverCom.ConnectToServer(9000)
              staticVar.sock=serverCom.sock
              self.thread_station.sock=serverCom.sock 
              
              
          except Exception:
              wx.MessageBox('reConnect To Monitor Server Failure!', 
                         'Alert', wx.ICON_EXCLAMATION | wx.STAY_ON_TOP)
          
 
          try:
              serverCom.ConnectToServer(9988)
              staticVar.sockFile=serverCom.sockFile
              self.thread_station.sockFile=serverCom.sockFile
              self.thread_upload.sockFile=serverCom.sockFile 
              break 
          except Exception:
              wx.MessageBox('reConnect To File Server Failure!', 
                         'Alert', wx.ICON_INFORMATION | wx.STAY_ON_TOP)
          time.sleep(5)
      
      self.thread_station.input1.append(staticVar.sock)
      self.thread_station.input1.append(staticVar.sockFile)
      
      
      ''' start all the thread '''
      
      self.thread_station.event.set()
      self.thread_upload.event.set()
Exemplo n.º 14
0
    def OnbtnOk(self, event):

        ID = int(self.StationID.GetValue())
        curStationPro = QueryCurStationPro()
        curStationPro.CommonHeader = FrameHeader(0x55, 0xA6,
                                                 staticVar.getid() & 0x00FF,
                                                 staticVar.getid() >> 8)
        curStationPro.CommonTail = FrameTail(0, 0, 0xAA)
        curStationPro.Identifier_h = ID >> 16
        curStationPro.Identifier_m = (ID & 0x00FF00) >> 8
        curStationPro.Identifier_l = ID & 0x0000FF

        if (self.radioBox.GetSelection()):
            curStationPro.LocateWay = 0x0F
        centreFreq = float(self.CentreFreq.GetValue())
        bandWidth = int(self.BandWidth.GetSelection()) + 1
        centreFreq_I = int(centreFreq)
        centreFreq_F = int((centreFreq - int(centreFreq)) * 2**10)
        curStationPro.Param.HighCentreFreqInteger = centreFreq_I >> 6
        curStationPro.Param.LowCentreFreqInteger = centreFreq_I & 0x003F
        curStationPro.Param.HighCentreFreqFraction = centreFreq_F >> 8
        curStationPro.Param.LowCentreFreqFraction = centreFreq_F & 0x0FF
        curStationPro.Param.UploadNum = int(self.UploadNum.GetValue())
        curStationPro.Param.DataRate = bandWidth
        curStationPro.Param.BandWidth = bandWidth

        startTime=(int(self.StartTimeYear.GetValue()),int(self.StartTimeMonth.GetValue()),  \
                   int(self.StartTimeDay.GetValue()),int(self.StartTimeHour.GetValue()),    \
                   int(self.StartTimeMinute.GetValue()),int(self.StartTimeSecond.GetValue()))

        curStationPro.Time.HighYear = startTime[0] >> 4
        curStationPro.Time.LowYear = startTime[0] & 0x00F
        curStationPro.Time.Month = startTime[1]
        curStationPro.Time.Day = startTime[2]
        curStationPro.Time.HighHour = startTime[3] >> 2
        curStationPro.Time.LowHour = startTime[3] & 0x03
        curStationPro.Time.Minute = startTime[4]
        curStationPro.Time.Second = startTime[5]

        if (staticVar.getSock()):
            staticVar.getSock().sendall(bytearray(curStationPro))
        self.Destroy()
Exemplo n.º 15
0
 def OnbtnOK(self,event):
 
     freqStart=int(self.FreqStart.GetValue())
     freqEnd=int(self.FreqEnd.GetValue())
     highFreqStart=freqStart>>16
     midFreqStart=(freqStart&0x00FF00)>>8
     lowFreqStart=freqStart&0x0000FF
     
     highFreqEnd=freqEnd>>16
     midFreqEnd=(freqEnd&0x00FF00)>>8
     lowFreqEnd=freqEnd&0x0000FF
     header=FrameHeader(0x55,0xA7,staticVar.getid()&0x00FF,staticVar.getid()>>8)
     tail=FrameTail(0,0,0xAA)
     structObj=QueryFreqPlan(header,highFreqStart,midFreqStart,  \
                             lowFreqStart,highFreqEnd,midFreqEnd,lowFreqEnd,tail)
    
    
     if(staticVar.getSock()):
         staticVar.getSock().sendall(bytearray(structObj))
     self.Destroy()
Exemplo n.º 16
0
    def reConnect(self):
        '''stop all thread related to sock '''
        self.thread_upload.stop()
        self.thread_station.stop()

        staticVar.getSock().close()
        staticVar.getSockFile().close()

        self.thread_station.input1 = []
        staticVar.sock = 0
        staticVar.sockFile = 0

        serverCom = ServerCommunication()  #实例化服务器连接对象
        while (1):
            try:
                serverCom.ConnectToServer(9000)
                staticVar.sock = serverCom.sock
                self.thread_station.sock = serverCom.sock

            except Exception:
                wx.MessageBox('reConnect To Monitor Server Failure!', 'Alert',
                              wx.ICON_EXCLAMATION | wx.STAY_ON_TOP)

            try:
                serverCom.ConnectToServer(9988)
                staticVar.sockFile = serverCom.sockFile
                self.thread_station.sockFile = serverCom.sockFile
                self.thread_upload.sockFile = serverCom.sockFile
                break
            except Exception:
                wx.MessageBox('reConnect To File Server Failure!', 'Alert',
                              wx.ICON_INFORMATION | wx.STAY_ON_TOP)
            time.sleep(5)

        self.thread_station.input1.append(staticVar.sock)
        self.thread_station.input1.append(staticVar.sockFile)
        ''' start all the thread '''

        self.thread_station.event.set()
        self.thread_upload.event.set()
    def OnbtnOK(self, event):
        reqElec = ReqElecTrend()
        reqElec.CommonHeader = FrameHeader(0x55, 0xA2, self.lowid, self.highid)
        reqElec.CommonTail = self.tail
        if (self.radioChoose.GetValue()):
            centreFreq = int(self.ListFreq[self.FreqSection.GetSelection()][0])
            bandWidth = int(self.ListFreq[self.FreqSection.GetSelection()][1])

        else:
            centreFreq = int(self.CentreFreq.GetValue())
            bandWidth = int(self.BandWidth.GetValue())

        reqElec.HighCentreFreq = centreFreq >> 8
        reqElec.LowCentreFreq = centreFreq & 0x00FF
        reqElec.BandWidth = bandWidth
        reqElec.Radius = int(self.Radius.GetValue())
        fenBianLv = float(self.FenBianLv.GetValue())
        startTime=(int(self.StartTimeYear.GetValue()),int(self.StartTimeMonth.GetValue()),  \
                   int(self.StartTimeDay.GetValue()),int(self.StartTimeHour.GetValue()),    \
                   int(self.StartTimeMinute.GetValue())
                   )
        endTime=(int(self.EndTimeYear.GetValue()),int(self.EndTimeMonth.GetValue()),  \
                   int(self.EndTimeDay.GetValue()),int(self.EndTimeHour.GetValue()),    \
                   int(self.EndTimeMinute.GetValue())
                   )

        reqElec.FenBianLvInteger = int(fenBianLv)
        reqElec.FenBianLvFraction = int((fenBianLv - int(fenBianLv)) * 8)

        reqElec.RefreshIntv = int(self.RefreshIntv.GetValue())
        reqElec.StartTime = self.ByteToTime(startTime)
        reqElec.EndTime = self.ByteToTime(endTime)

        if (staticVar.getSock()):
            staticVar.getSock().sendall(bytearray(reqElec))
            for i in bytearray(reqElec):
                print i,

        self.Destroy()
 def HistoryDataQuery(self,functionPara):
     Obj=ReqData()
     
     startTime=(int(self.StartTimeYear.GetValue()),int(self.StartTimeMonth.GetValue()),  \
                int(self.StartTimeDay.GetValue()),int(self.StartTimeHour.GetValue()),    \
                int(self.StartTimeMinute.GetValue())
                )
     endTime=(int(self.EndTimeYear.GetValue()),int(self.EndTimeMonth.GetValue()),  \
                int(self.EndTimeDay.GetValue()),int(self.EndTimeHour.GetValue()),    \
                int(self.EndTimeMinute.GetValue())
                )
     apointID=int(self.ApointID.GetValue())
     
     Obj.CommonHeader=FrameHeader(0x55,functionPara,staticVar.getid()&0x00FF,staticVar.getid()>>8)
     Obj.CommonTail=FrameTail(0,0,0xAA)
     Obj.ApointID_h=apointID>>8
     Obj.ApointID_l=apointID&0x00FF
     Obj.StartTime=self.ByteToTime(startTime)
     Obj.EndTime=self.ByteToTime(endTime)
     
     if(staticVar.getSock()):
         staticVar.getSock().sendall(bytearray(Obj))
Exemplo n.º 19
0
    def OnbtnOk(self,event):
        reqAb=ReqAbFreq()
        reqAb.CommonHeader=FrameHeader(0x55,0xA4,self.lowid,self.highid)
        reqAb.CommonTail=self.tail
        if(self.radioBox.GetSelection()):
            reqAb.LocateWay=0x0F
        centreFreq=float(self.CentreFreq.GetValue())  
        bandWidth=int(self.BandWidth.GetSelection())+1  
        centreFreq_I=int(centreFreq)
        centreFreq_F=int((centreFreq-int(centreFreq))*2**10)
        reqAb.Param.HighCentreFreqInteger=centreFreq_I>>6
        reqAb.Param.LowCentreFreqInteger=centreFreq_I&0x003F
        reqAb.Param.HighCentreFreqFraction=centreFreq_F>>8
        reqAb.Param.LowCentreFreqFraction=centreFreq_F&0x0FF
        reqAb.Param.UploadNum=int(self.UploadNum.GetValue())
        reqAb.Param.DataRate=bandWidth
        reqAb.Param.BandWidth=bandWidth
        
        startTime=(int(self.StartTimeYear.GetValue()),int(self.StartTimeMonth.GetValue()),  \
                   int(self.StartTimeDay.GetValue()),int(self.StartTimeHour.GetValue()),    \
                   int(self.StartTimeMinute.GetValue()),int(self.StartTimeSecond.GetValue()))
                   
        
       
        reqAb.Time.HighYear=startTime[0]>>4
        reqAb.Time.LowYear=startTime[0]&0x00F
        reqAb.Time.Month=startTime[1]
        reqAb.Time.Day=startTime[2]
        reqAb.Time.HighHour=startTime[3]>>2
        reqAb.Time.LowHour=startTime[3]&0x03
        reqAb.Time.Minute=startTime[4]
        reqAb.Time.Second=startTime[5]
        
        if(staticVar.getSock()):
            staticVar.getSock().sendall(bytearray(reqAb))


    
        self.Destroy()
    def hello(self):

        print '----------------------------------------------------------------------'
        staticVar.getSock().sendall(struct.pack("!B", 0x55))
        staticVar.getSock().sendall(struct.pack("!B", 0x66))
        if(self.count_heart<=staticVar.count_heat_beat):
            self.count_heart=staticVar.count_heat_beat
        else:
            print 're--------connect---------------'
            staticVar.sock=0
            staticVar.sockFile=0
            
            self.thread_station.input1=[]
            
            while (1):
                try:
                    self.serverCom.ConnectToServer(9000)
                    staticVar.sock = self.serverCom.sock
                    self.thread_station.input1.append(staticVar.sock)
                except Exception:
                    wx.MessageBox('Connect To Monitor Server Failure!',
                                  'Alert', wx.ICON_EXCLAMATION | wx.STAY_ON_TOP)


                try:
                    self.serverCom.ConnectToServer(9988)
                    staticVar.sockFile = self.serverCom.sockFile
                    self.thread_station.input1.append(staticVar.sockFile)
                    break
                except Exception:
                    wx.MessageBox('Connect To File Server Failure!',
                                  'Alert', wx.ICON_INFORMATION | wx.STAY_ON_TOP)
                time.sleep(5)
                
                

        self.timer = threading.Timer(15, self.hello, [])
        self.timer.start()
Exemplo n.º 21
0
    def hello(self):

        print '----------------------------------------------------------------------'
        staticVar.getSock().sendall(struct.pack("!B", 0x55))
        staticVar.getSock().sendall(struct.pack("!B", 0x66))
        if(self.count_heart<=staticVar.count_heat_beat):
            self.count_heart=staticVar.count_heat_beat
        else:
            print 're--------connect---------------'
            staticVar.sock=0
            staticVar.sockFile=0
            
            self.thread_station.input1=[]
            
            while (1):
                try:
                    self.serverCom.ConnectToServer(9000)
                    staticVar.sock = self.serverCom.sock
                    self.thread_station.input1.append(staticVar.sock)
                except Exception:
                    wx.MessageBox('Connect To Monitor Server Failure!',
                                  'Alert', wx.ICON_EXCLAMATION | wx.STAY_ON_TOP)


                try:
                    self.serverCom.ConnectToServer(9988)
                    staticVar.sockFile = self.serverCom.sockFile
                    self.thread_station.input1.append(staticVar.sockFile)
                    break
                except Exception:
                    wx.MessageBox('Connect To File Server Failure!',
                                  'Alert', wx.ICON_INFORMATION | wx.STAY_ON_TOP)
                time.sleep(5)
                
                

        self.timer = threading.Timer(15, self.hello, [])
        self.timer.start()
    def __init__(self, mainframe):
        threading.Thread.__init__(self)

        self.dictFreqPlan = staticVar.getdictFreqPlan()
        self.event = threading.Event()
        self.event.set()
        self.sock = staticVar.getSock()
        self.sockFile = staticVar.getSockFile()
        self.outPoint = staticVar.outPoint
        self.specFrame = mainframe.SpecFrame
        self.specFrame.iq_sequence = 0

        self.mainframe = mainframe
        self.input1 = [self.sock, self.sockFile]  ##便于timer 控制