Software to access GSM Terminal, sending and receiving AT commands, validating results

I am currently implementing a software that uses a GSM terminal to perform actions. Actions can be sending messages, checking balance, receiving status report messages, setting the pin, …

The communication between terminal and program runs over a serial port. I am sending AT commands (basically strings) to the device that executes them and returns a message depending on the command. I have a limited set of about 20 different commands that need to be executed and some of them have the same return messages (just OK or ERROR). While waiting for a return value is it possible that an incoming message notification is returned instead and the actual value the program is waiting for arrives later.

I need to consider that in the future the GSM terminal shall be exchangeable easily. The AT command set is mostly standardized, but the return values can differ between manufacturers and even mobile operators…

I am struggling to find a good generic design concept. The tasks to be performed are the following:

  • Check if response belongs to the command sent
  • Check if response is valid (command worked or not)

The rest of the system is running well (reliable sending and receiving, timeouts, retransmit in case of errors, etc…), it’s just about verifying return values that can happen to belong to several commands sent.

I am using an event based observer system. Every time a return value is received it is published to all subscribers which will process the result. Before sending a command to the serial interface, a component registers with the observer and unregisters if its job is done. But if I have two subscribers that wait for a result and both expect OK it gets complicated.

I am on my own at the moment so I’d appreciate some help and inspiration here.

AT commands are generally not designed to be multiplexed over a single channel, so if you have sent multiple requests without waiting for the responses, it is very likely that you will get the responses in the same order as that you sent the requests (although it is better to simply wait for a final response before sending the next request).

If it is possible that you get unsolicited messages intermixed with the request/response messages, you could chain the message handlers.
If you do that, you first present a received message to the response handler of the oldest unfinished request. If that handler indicates it couldn’t process the message, you go to the next handler in the chain (the next oldest unfinished request). If you reached the end of the chain of unfinished requests, you present the message to the handler(s) for unsolicited messages.
Once any handler indicates it has processed the message, you stop the chain right there and no further handlers will get to see it. This prevents responses like OK to complete multiple requests.
This can be implemented using the Chain of Responsibility pattern, or simply as a loop over an ordered list of message handlers.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Software to access GSM Terminal, sending and receiving AT commands, validating results

I am currently implementing a software that uses a GSM terminal to perform actions. Actions can be sending messages, checking balance, receiving status report messages, setting the pin, …

The communication between terminal and program runs over a serial port. I am sending AT commands (basically strings) to the device that executes them and returns a message depending on the command. I have a limited set of about 20 different commands that need to be executed and some of them have the same return messages (just OK or ERROR). While waiting for a return value is it possible that an incoming message notification is returned instead and the actual value the program is waiting for arrives later.

I need to consider that in the future the GSM terminal shall be exchangeable easily. The AT command set is mostly standardized, but the return values can differ between manufacturers and even mobile operators…

I am struggling to find a good generic design concept. The tasks to be performed are the following:

  • Check if response belongs to the command sent
  • Check if response is valid (command worked or not)

The rest of the system is running well (reliable sending and receiving, timeouts, retransmit in case of errors, etc…), it’s just about verifying return values that can happen to belong to several commands sent.

I am using an event based observer system. Every time a return value is received it is published to all subscribers which will process the result. Before sending a command to the serial interface, a component registers with the observer and unregisters if its job is done. But if I have two subscribers that wait for a result and both expect OK it gets complicated.

I am on my own at the moment so I’d appreciate some help and inspiration here.

AT commands are generally not designed to be multiplexed over a single channel, so if you have sent multiple requests without waiting for the responses, it is very likely that you will get the responses in the same order as that you sent the requests (although it is better to simply wait for a final response before sending the next request).

If it is possible that you get unsolicited messages intermixed with the request/response messages, you could chain the message handlers.
If you do that, you first present a received message to the response handler of the oldest unfinished request. If that handler indicates it couldn’t process the message, you go to the next handler in the chain (the next oldest unfinished request). If you reached the end of the chain of unfinished requests, you present the message to the handler(s) for unsolicited messages.
Once any handler indicates it has processed the message, you stop the chain right there and no further handlers will get to see it. This prevents responses like OK to complete multiple requests.
This can be implemented using the Chain of Responsibility pattern, or simply as a loop over an ordered list of message handlers.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật