Exemple #1
0
 def enable_radio(self, enable):
     """
     Enables/disable radio stack
     """
     cmd = ATCmd("AT+CFUN=%d" % int(enable), name='enable_radio')
     cmd.timeout = 30
     return self.queue_at_cmd(cmd)
Exemple #2
0
    def get_phonebook_size(self):
        """
        Returns the phonebook size of the SIM card

        :raise General: When the SIM is not ready.
        :raise SimBusy: When the SIM is not ready.
        :raise CMSError500: When the SIM is not ready.
        """
        cmd = ATCmd('AT+CPBR=?', name='get_phonebook_size')
        cmd.timeout = 15
        return self.queue_at_cmd(cmd)
Exemple #3
0
 def send_at(self, at_str, name='send_at', timeout=None):
     """Send an arbitrary AT string to the SIM card"""
     cmd = ATCmd(at_str, name=name)
     if timeout:
         cmd.timeout = timeout
     return self.queue_at_cmd(cmd)
Exemple #4
0
 def send_ussd(self, ussd):
     """Sends the USSD command ``ussd``"""
     dcs = 15
     cmd = ATCmd('AT+CUSD=1,"%s",%d' % (ussd, dcs), name='send_ussd')
     cmd.timeout = 30
     return self.queue_at_cmd(cmd)
Exemple #5
0
 def send_sms(self, pdu, pdu_len):
     """Sends the given pdu and returns the index"""
     cmd = ATCmd('AT+CMGS=%d' % pdu_len, name='send_sms', eol='\r')
     cmd.splitcmd = '%s\x1a' % pdu
     return self.queue_at_cmd(cmd)
Exemple #6
0
 def save_sms(self, pdu, pdu_len):
     """Returns the index where ``pdu`` was stored"""
     cmd = ATCmd('AT+CMGW=%s' % pdu_len, name='save_sms', eol='\r')
     cmd.splitcmd = '%s\x1a' % pdu
     return self.queue_at_cmd(cmd)
Exemple #7
0
 def register_with_netid(self, netid, mode=1, _format=2):
     """Registers with ``netid``"""
     atstr = 'AT+COPS=%d,%d,"%s"' % (mode, _format, netid)
     cmd = ATCmd(atstr, name='register_with_netid')
     cmd.timeout = 30
     return self.queue_at_cmd(cmd)
Exemple #8
0
 def get_network_names(self):
     """Returns a tuple with the network info"""
     cmd = ATCmd('AT+COPS=?', name='get_network_names')
     cmd.timeout = 120
     return self.queue_at_cmd(cmd)