Hayes AT Commands: Detect Remote Hangup?

前端 未结 2 1829
死守一世寂寞
死守一世寂寞 2020-12-20 06:39

How are you supposed to programatically detect when the remote modem on your call hangs up? I am writing a C program which interfaces with a SoftModem device /dev/ttyS

2条回答
  •  误落风尘
    2020-12-20 07:04

    Testing for NO CARRIER as text will not suffice. This text frequently occurs on sites in the net, even on Q&A sites.

    Coming from the modem, it should be enclosed in line breaks.

    Besides, after you detect that text, you can try to switch to command mode with +++. If that works, your connection persists and you can reattach it and continue using it. If it doesn't (because you are already there and +++ is an invalid command), the connection has gone.

提交回复
热议问题