def check(self, update):
        if io.input(4) == 0: #Check the GPIO connected to the key pin on the FONA
            try:
                #Get number of sms messages
                num_sms = self.fona.transmit('AT+CPMS?')
                num_sms = num_sms[1]
                num_sms = num_sms.split(',')
                num_sms = num_sms[1]
                num_sms = int(num_sms)
                if num_sms > self.total_sms: #If there is more messages than before, a SMS has arrived. otherwise a call is coming
                    print 'New Message!'
                    self.total_sms = num_sms
                else:
                    self.call_coming = True
            except:
                pass
            
            update = True

        else:
            update = True
            
        if self.call_coming:
            self.incoming_call()
        return update
dataset/ETHPy150Open spadgenske/TYOS/src/receive.py/Receive.check/original