I'm sorry if I'm not asking in the right way, but this is my first post here. Until now, I've often been here, but only read. I have an old device that sends an SMS through a Siemens C35i phone when certain activities are detected. The Siemens C35i is an old model and that's why I wanted to cheat the device a bit and connect to it through a Raspberry Pi to read these SMS messages and save them on a server like www. I have no experience in this type of programming, but I managed to connect the device to the Raspberry Pi and read the initial commands sent by the device. At the beginning, the device sends ATE0 and soon after AT+CGMM to make sure that the C35i phone is connected. I managed to write a program that responds, but the device reads only the first two characters of the response, which is C3, and the rest is cut off. What can I do to make the Raspberry Pi respond with the full identifier? Where can I make corrections? Here's my program:
import serial
import time
ser = serial.Serial('/dev/ttyUSB0', 19200) # ustawienia portu COM
at_file = open("AT.dat", "a") # otwarcie pliku AT.dat do zapisu
serial_file = open("serial.dat", "a") # otwarcie pliku serial.dat do zapisu
while True:
data = ser.readline() # odczytanie jednej linii danych z portu COM
data_str = data.decode("cp1252").strip() # konwersja danych na string
if "AT+CGMM" in data_str: # jeśli transmisja zawiera kody AT
response = "C35i"
# Wysłanie odpowiedzi
ser.write((response + "\r\n").encode("cp1252"))
print(response)
at_file.write(data_str + "\n") # zapis do pliku AT.dat
else:
serial_file.write(data_str + "\n") # zapis do pliku serial.dat