def add_packet(self, full=None, scapy=None, bytes=None, rssi=None, location=None, datetime=None, channel=None, page=0):
    if (self.conn == None):
        raise Exception('DBLogger requires active connection status.')
    if ((bytes == None) and ('bytes' in full)):
        bytes = full['bytes']
    if ((rssi == None) and ('rssi' in full)):
        rssi = full['rssi']
    if ((datetime == None) and ('datetime' in full)):
        datetime = full['datetime']
    if ((location == None) and ('location' in full)):
        location = full['location']
    loc_id = (self.add_location(location) if (location is not None) else None)
    if (scapy == None):
        import logging
        logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
        from scapy.all import Dot15d4
        scapy = Dot15d4(bytes)
    try:
        srcaddr = scapy.src_addr
    except:
        srcaddr = None
    try:
        srcpan = scapy.src_panid
    except:
        srcpan = None
    srcdevid = self.add_device(srcaddr, srcpan)
    try:
        destaddr = scapy.dest_addr
    except:
        destaddr = None
    try:
        destpanid = scapy.dest_panid
    except:
        destpanid = None
    destdevid = self.add_device(destaddr, destpanid)
    sql = []
    sql.append(('ds_id=%d' % self.ds_id))
    sql.append('db_datetime=NOW()')
    if (datetime != None):
        sql.append(("cap_datetime='%s'" % str(datetime)))
    if (self.channel != None):
        sql.append(('channel=%d' % self.channel))
    if self.page:
        sql.append(('page=%d' % self.page))
    if (srcdevid != None):
        sql.append(('source=%d' % srcdevid))
    if (destdevid != None):
        sql.append(('dest=%d' % destdevid))
    if (rssi != None):
        sql.append(('rssi=%d' % rssi))
    if (loc_id != None):
        sql.append(('loc_id=%d' % loc_id))
    if (channel != None):
        sql.append(('channel=%d' % channel))
    if page:
        sql.append(('page=%d' % page))
    sql.append(('fcf_panidcompress=%d' % scapy.fcf_panidcompress))
    sql.append(('fcf_ackreq=%d' % scapy.fcf_ackreq))
    sql.append(('fcf_pending=%d' % scapy.fcf_pending))
    sql.append(('fcf_security=%d' % scapy.fcf_security))
    sql.append(('fcf_frametype=%d' % scapy.fcf_frametype))
    sql.append(('fcf_srcaddrmode=%d' % scapy.fcf_srcaddrmode))
    sql.append(('fcf_framever=%d' % scapy.fcf_framever))
    sql.append(('fcf_destaddrmode=%d' % scapy.fcf_destaddrmode))
    sql.append(('seqnum=%d' % scapy.seqnum))
    return self.insert(' '.join(['INSERT INTO packets SET', ', '.join(sql)]), packetbytes=bytes)
def add_packet(self, full=None, scapy=None, bytes=None, rssi=None, location=None, datetime=None, channel=None, page=0):
    if (self.conn == None):
        raise Exception('DBLogger requires active connection status.')
    if ((bytes == None) and ('bytes' in full)):
        bytes = full['bytes']
    if ((rssi == None) and ('rssi' in full)):
        rssi = full['rssi']
    if ((datetime == None) and ('datetime' in full)):
        datetime = full['datetime']
    if ((location == None) and ('location' in full)):
        location = full['location']
    loc_id = (self.add_location(location) if (location is not None) else None)
    if (scapy == None):
        import logging
        logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
        from scapy.all import Dot15d4
        scapy = Dot15d4(bytes)
    try:
        srcaddr = scapy.src_addr
    except:
        srcaddr = None
    try:
        srcpan = scapy.src_panid
    except:
        srcpan = None
    srcdevid = self.add_device(srcaddr, srcpan)
    try:
        destaddr = scapy.dest_addr
    except:
        destaddr = None
    try:
        destpanid = scapy.dest_panid
    except:
        destpanid = None
    destdevid = self.add_device(destaddr, destpanid)
    sql = []
    sql.append(('ds_id=%d' % self.ds_id))
    sql.append('db_datetime=NOW()')
    if (datetime != None):
        sql.append(("cap_datetime='%s'" % str(datetime)))
    if (self.channel != None):
        sql.append(('channel=%d' % self.channel))
    if self.page:
        sql.append(('page=%d' % self.page))
    if (srcdevid != None):
        sql.append(('source=%d' % srcdevid))
    if (destdevid != None):
        sql.append(('dest=%d' % destdevid))
    if (rssi != None):
        sql.append(('rssi=%d' % rssi))
    if (loc_id != None):
        sql.append(('loc_id=%d' % loc_id))
    if (channel != None):
        sql.append(('channel=%d' % channel))
    if page:
        sql.append(('page=%d' % page))
    sql.append(('fcf_panidcompress=%d' % scapy.fcf_panidcompress))
    sql.append(('fcf_ackreq=%d' % scapy.fcf_ackreq))
    sql.append(('fcf_pending=%d' % scapy.fcf_pending))
    sql.append(('fcf_security=%d' % scapy.fcf_security))
    sql.append(('fcf_frametype=%d' % scapy.fcf_frametype))
    sql.append(('fcf_srcaddrmode=%d' % scapy.fcf_srcaddrmode))
    sql.append(('fcf_framever=%d' % scapy.fcf_framever))
    sql.append(('fcf_destaddrmode=%d' % scapy.fcf_destaddrmode))
    sql.append(('seqnum=%d' % scapy.seqnum))
    return self.insert(' '.join(['INSERT INTO packets SET', ', '.join(sql)]), packetbytes=bytes)