def _publish(self, sender, signal, data):
    newData = []
    mac = data['mac']
    if (signal in ['parsedAppData_OAPTemperature']):
        temperature_C = (float(data['fields']['temperature']) / 100.0)
        newData += [{'mac': mac, 'type': 'temperature', 'lastvalue': str(temperature_C), 'lastupdated': str(data['timestamp']), 'subscribeToLed': True}]
    elif (signal in ['parsedAppData_DC2126A']):
        temperature = self.dc2126Aconverters.convertTemperature(data['fields']['temperature'])
        if (temperature != None):
            newData += [{'mac': mac, 'type': 'temperature', 'lastvalue': str(temperature), 'lastupdated': str(data['timestamp'])}]
        adcValue = self.dc2126Aconverters.convertAdcValue(data['fields']['adcValue'])
        newData += [{'mac': mac, 'type': 'voltage', 'lastvalue': adcValue, 'lastupdated': str(data['timestamp'])}]
        energysource = self.dc2126Aconverters.convertEnergySource(mac, adcValue)
        newData += [{'mac': mac, 'type': 'energysource', 'lastvalue': energysource, 'lastupdated': str(data['timestamp'])}]
    elif (signal in ['parsedAppData_SPIPressure']):
        with self.dataLock:
            if (mac in self.pressureOffsets):
                offset = self.pressureOffsets[mac]
            else:
                offset = 0
        newData += [{'mac': mac, 'type': 'pressure', 'lastvalue': ((str(data['fields']['adcPressure']) + '_') + str(offset)), 'lastupdated': str(data['timestamp'])}]
    elif (signal in ['parsedAppData_GPIONet']):
        if (data['fields']['pinVal'] == 1):
            energysource = 'solar'
        elif (data['fields']['pinVal'] == 2):
            energysource = 'vibration'
        elif (data['fields']['pinVal'] == 3):
            energysource = 'temperature'
        else:
            energysource = 'battery'
        newData += [{'mac': mac, 'type': 'energysource', 'lastvalue': energysource, 'lastupdated': str(data['timestamp'])}]
    elif (signal in ['parsedAppData_LIS331']):
        newData += [{'mac': mac, 'type': 'acceleration', 'lastvalue': '{0}_{1}_{2}'.format(data['fields']['x'], data['fields']['y'], data['fields']['z']), 'lastupdated': str(data['timestamp'])}]
    elif (signal in ['parsedAppData_OAPtilt']):
        newData += [{'mac': mac, 'type': 'tilt', 'lastvalue': '{0}'.format(data['fields']['status']), 'lastupdated': str(data['timestamp'])}]
    else:
        raise SystemError('unexpected signal={0}'.format(signal))
    with self.dataLock:
        for nd in newData:
            found = False
            newDataSource = nd['mac']
            newDataType = nd['type']
            for (i, e) in enumerate(self.mirrordata):
                if ((e['mac'] == newDataSource) and (e['type'] == newDataType)):
                    found = True
                    self.mirrordata[i] = nd
                    break
            if (not found):
                self.mirrordata.append(nd)
    with self.dataLock:
        for nd in newData:
            dispatcher.send(signal='newDataMirrored', data=copy.deepcopy(nd))
def _publish(self, sender, signal, data):
    newData = []
    mac = data['mac']
    if (signal in ['parsedAppData_OAPTemperature']):
        temperature_C = (float(data['fields']['temperature']) / 100.0)
        newData += [{'mac': mac, 'type': 'temperature', 'lastvalue': str(temperature_C), 'lastupdated': str(data['timestamp']), 'subscribeToLed': True}]
    elif (signal in ['parsedAppData_DC2126A']):
        temperature = self.dc2126Aconverters.convertTemperature(data['fields']['temperature'])
        if (temperature != None):
            newData += [{'mac': mac, 'type': 'temperature', 'lastvalue': str(temperature), 'lastupdated': str(data['timestamp'])}]
        adcValue = self.dc2126Aconverters.convertAdcValue(data['fields']['adcValue'])
        newData += [{'mac': mac, 'type': 'voltage', 'lastvalue': adcValue, 'lastupdated': str(data['timestamp'])}]
        energysource = self.dc2126Aconverters.convertEnergySource(mac, adcValue)
        newData += [{'mac': mac, 'type': 'energysource', 'lastvalue': energysource, 'lastupdated': str(data['timestamp'])}]
    elif (signal in ['parsedAppData_SPIPressure']):
        with self.dataLock:
            if (mac in self.pressureOffsets):
                offset = self.pressureOffsets[mac]
            else:
                offset = 0
        newData += [{'mac': mac, 'type': 'pressure', 'lastvalue': ((str(data['fields']['adcPressure']) + '_') + str(offset)), 'lastupdated': str(data['timestamp'])}]
    elif (signal in ['parsedAppData_GPIONet']):
        if (data['fields']['pinVal'] == 1):
            energysource = 'solar'
        elif (data['fields']['pinVal'] == 2):
            energysource = 'vibration'
        elif (data['fields']['pinVal'] == 3):
            energysource = 'temperature'
        else:
            energysource = 'battery'
        newData += [{'mac': mac, 'type': 'energysource', 'lastvalue': energysource, 'lastupdated': str(data['timestamp'])}]
    elif (signal in ['parsedAppData_LIS331']):
        newData += [{'mac': mac, 'type': 'acceleration', 'lastvalue': '{0}_{1}_{2}'.format(data['fields']['x'], data['fields']['y'], data['fields']['z']), 'lastupdated': str(data['timestamp'])}]
    elif (signal in ['parsedAppData_OAPtilt']):
        newData += [{'mac': mac, 'type': 'tilt', 'lastvalue': '{0}'.format(data['fields']['status']), 'lastupdated': str(data['timestamp'])}]
    else:
        raise SystemError('unexpected signal={0}'.format(signal))
    with self.dataLock:
        for nd in newData:
            found = False
            newDataSource = nd['mac']
            newDataType = nd['type']
            for (i, e) in enumerate(self.mirrordata):
                if ((e['mac'] == newDataSource) and (e['type'] == newDataType)):
                    found = True
                    self.mirrordata[i] = nd
                    break
            if (not found):
                self.mirrordata.append(nd)
    with self.dataLock:
        for nd in newData:
            dispatcher.send(signal='newDataMirrored', data=copy.deepcopy(nd))