-
Метод: отправка SMS
Описание: отправка SMS с помощью Nokia 3310 Pro.
Пример кода:import serial def send_sms(phone_number, message): ser = serial.Serial('COM1', 9600) # Replace 'COM1' with the appropriate serial port ser.write('AT+CMGF=1\r'.encode('utf-8')) ser.write('AT+CMGS="{}"\r'.format(phone_number).encode('utf-8')) ser.write('{}\r'.format(message).encode('utf-8')) ser.write(chr(26).encode('utf-8')) response = ser.readlines() ser.close() return response # Usage example phone_number = '1234567890' message = 'Hello from Nokia 3310 Pro!' response = send_sms(phone_number, message) print(response) -
Метод: выполнение вызова
Описание: выполнение вызова с помощью Nokia 3310 Pro.
Пример кода:import serial def make_call(phone_number): ser = serial.Serial('COM1', 9600) # Replace 'COM1' with the appropriate serial port ser.write('ATD{};\r'.format(phone_number).encode('utf-8')) response = ser.readlines() ser.close() return response # Usage example phone_number = '1234567890' response = make_call(phone_number) print(response) -
Метод: получение контактов
Описание: получение контактов с Nokia 3310 Pro.
Пример кода:import serial def retrieve_contacts(): ser = serial.Serial('COM1', 9600) # Replace 'COM1' with the appropriate serial port ser.write('AT+CPBR=1,100\r'.encode('utf-8')) response = ser.readlines() ser.close() return response # Usage example contacts = retrieve_contacts() print(contacts)