Jump to content

Recommended Posts

Posted

Hello!!! I want to share this UDF I've made with @mLipok, for some personal reason We stopped UDF development at 26-10-2020. So this can still be not fully operational.

 

Donwload Link:

https://www.autoitscript.com/forum/files/file/512-atcmdau3-udf/

 

 

 

 

 

Saludos

Posted

Good to see you again active on the forum.
As to ATCmd.au3
I must check it again and make some guideline how use them, as this is strongly related to the device you choose, and to GSM operator you have.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 2 years later...
Posted

@Danyfirex I have few mod to this UDF.
I want to move development process to GitHub.
I would like to ask if you have any restrictions when it comes to transferring the project to the GitHub platform under my supervision under the MIT license.

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

@mLipok sure do it. I don't care. It would be great to have it on GitHub. You're the boss :thumbsup:

 

Saludos

Posted (edited)

Fine.
I will do it in the comming week.
As so far I have finally done UCS support in sending SMS and _ATCmd_SMS_ListMessages()

Must to check it with few GSM modem and then I be ready to publish.

As so far tested with: ZTE MF631

and with  LC SIM800C V3
    ( the same model as posted by @Viszna here ... - in fact, I received this modem as a gift a few years ago from @Viszna Thanks bro ).

I still have to test it with few Huawei models.

After that I need to test all the same modem devices, but with another GSM service provider (currently T-Mobile, but I also have Orange).

 

EDIT 1:
tested with HUAWEI E3131 - works well.

 

EDIT 2:
tested with HUAWEI E176G - works well.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

So this will be last UDF version published this way (as attachment here).
For future update please take a look:  
https://github.com/mlipok/ATCmd.au3

 

  Quote

    1.2.1
    2023/10/10
    .    $ATCmd_ERR_COMMTIMEOUT - mLipok
    .    $ATCmd_CMGLPDU_* - parameters for _ATCmd_SMS_ListMessages() - mLipok
    .    $ATCmd_CMGLTEXT - list of parameters (an array) for _ATCmd_SMS_ListMessages() - mLipok
    .    $ATCmd_TestingMode - for developer testing - mLipok
    .
    .    __ATCmd_WaitResponse() - reports $ATCmd_ERR_COMMTIMEOUT - mLipok
    .    __ATCmd_WaitResponse() - reports $ATCmd_ERR_COMMERROR - mLipok
    .    __ATCmd_WaitResponse() - refactored for better TimeOut handling - mLipok
    .    __ATCmd_WaitResponse() - refactored for better Error handling - mLipok
    .    __ATCmd_WaitSuccess() - checks __ATCmd_LastSent() and uses _ATCmd_UsePDU() or _ATCmd_UseUCS2() accordingly - mLipok
    .    __ATCmd_UCS2HexToString() - mLipok
    .    __ATCmd_DefaultConfig() - USC2 support - mLipok
    .    _ATCmd_SMS_ListTextMessages() - renamed to: __ATCmd_SMS_ListMessagesToArray() - mLipok
    .    __ATCmd_SMS_ListMessagesToArray() - USC2 support - mLipok
    .
    .    _ATCmd_Connect() - refactored - mLipok
    .    _ATCmd_Connect() - $sPIN parameter added - mLipok
    .    _ATCmd_GetAllStatus() - small fixes - mLipok
    .    _ATCmd_Command() - support for $ATCmd_CTRL_Z - mLipok
    .    _ATCmd_SMS_Sender() - rafactorization - separation of: _ATCmd_UsePDU() and _ATCmd_UseUCS2() - mLipok
    .    _ATCmd_SMS_Sender() - USC2 support - mLipok
    .    _ATCmd_SMS_Sender() - better error handling - mLipok
    .    _ATCmd_SMS_Sender() - uses _ATCmd_Command() instead _COM_SendChar() to send $ATCmd_CTRL_Z - mLipok
    .    _ATCmd_CMEESetup() - removed as not used anymore - mLipok
    .    _ATCmd_CommandSyncOK() is mostly used instead _ATCmd_Command() - mLipok
 

Expand  

 

ATCmd_1.2.1.zipFetching info...

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 4 weeks later...
Posted (edited)

I've been working with COMUDF.au3 and ATCmd.au3 for a few days and am having connection consistency issues.  My code isn't changing.  Period.  I run the same code over and over.  Roughly 50% of the time it works as desired.  The other times, I cannot open a serial port handle... returns -1.

No matter what tweaking I've tried seems to change that.  I've carefully looked at all of my device settings on my Win10 PC and cannot find anything relevant that would interfere with it.  If I loop the code for creating a handle -- whether that be _ATCmd_Connect or _COM_OpenPort() -- it just fails that number of loops.  I can't "flush" any buffers or other functions because they all require a handle.  I was only getting about a 30% success rate but added _ATCmd_GetAllStatus(true,false) to the mix (just after the connect, of course) and inexplicably that seems to have improved (but far from eliminated) the success rate.  I need this to work every time, period.  So, I'm stuck and would appreciate any help.

(Yes, I've mixed and matched and removed large swathes of code in ATCmd.au3 to make this simple, but like I said, it works about 50% of the time.  The rest of the time, I can't get a handle.  Usually when running from the IDE I have to hit Ctrl-Break to terminate the attempt if it doesn't get a handle.)

Pseudo-code:

_ATCmd_Connect($g_sDeviceName,'','baud=9600 parity=n data=8 stop=1 dtr=on rts=on to=off')

$a_AllStatus = _ATCmd_GetAllStatus(true,false)

ConsoleWrite("_ATCmd_CommandSyncOK('AT+BAUD=?')" & @CRLF)
$s_rt = _ATCmd_CommandSyncOK("AT+BAUD=?",3)

_ATCmd_Disconnect()  ; although, even if I leave this out, it seems to know to disconnect!

So, nothing elaborate.  In ATCmd.au3, I added these lines after _COM_OpenPort so that I'd see an immediate error if I didn't get a handle:

Local $hCOMPort = _COM_OpenPort($sCOMPort)
    _ATCmd_ErrorLog(@ScriptLineNumber & ' ATCmd: Unable to Open Port: ' & $sCOMPort)
    if $hCOMPort=-1 then
        ConsoleWrite("_ATCmd_Connect : Unable to Open Port using: " & $sCOMPort & @CRLF)
    EndIf

Naturally, if I get the handle, I get a "response: OK+BAUD=9600" but if not then a zero.

Using terminal programs (RealTerm, CoolTerm, etc.) I can successfully connect about the same amount of time, and send successful AT commands.  I thought that the CoolTerm "Flush Serial Port" command helped for a while, but it's still about 50/50.  I have no idea what that button does.

Any suggestions about where I go from here?

 

 

Edited by RobertL
Posted
  On 11/3/2023 at 3:24 AM, RobertL said:

I've been working with COMUDF.au3 and ATCmd.au3 for a few days and am having connection consistency issues.  My code isn't changing.  Period.  I run the same code over and over.  Roughly 50% of the time it works as desired.  The other times, I cannot open a serial port handle... returns -1.

Expand  

 

  On 11/3/2023 at 3:24 AM, RobertL said:

Using terminal programs (RealTerm, CoolTerm, etc.) I can successfully connect about the same amount of time, and send successful AT commands.  I thought that the CoolTerm "Flush Serial Port" command helped for a while, but it's still about 50/50.

Expand  

 

please try 

https://m2msupport.net/m2msupport/software-and-at-commands-for-m2m-modules/

And tell me, are you facing the same problem with this program?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

btw.
You can also use the free version

https://github.com/tomazas/ATCommandTester

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Thanks for that!  I played with it for a while.  It would Find Port (COM3) but never connect.  And usually after 2 or 3 tries, it would crash.  I find it strange my code will connect about half the time, but this one not at all.  I unplugged the USB-Serial device (Friendly name: Silicon Labs CP210x USB to UART Bridge) and waited a while, plugged it back in, but with the same results (a crash after trying a few times).  Attached is the log file dump.

I'm now trying to review the original driver manual on their suggested ways of connecting, but it's slow going.

 

hs_err_pid68448.logFetching info...

Posted
  On 11/3/2023 at 4:35 PM, RobertL said:

Silicon Labs CP210x USB to UART Bridge

Expand  

you mean this one
https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=documentation
 

?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I went ahead and spent the $10 for the "standard" ATCommandTester, and upon using it's Connect button, the attempts and results were a lot more robust, but still no joy in Mudville.  I may have to find a different USB-Serial device with a different driver.  Sigh.

 

Found ports :COM3


Sending AT query..
OK
Disconnecting port COM3.

Retry connecting COM3 at 9600 with flow control enabled

Sending AT query..
OK
Disconnecting port COM3.

Retry connecting COM3 at 9600

Sending AT query..
f�������Disconnecting port COM3.

Retry connecting COM3 at 9600 with flow control enabled

Sending AT query..
f�������Disconnecting port COM3.

Retry connecting COM3 at 19200

Sending AT query..
f�������Disconnecting port COM3.

Retry connecting COM3 at 19200 with flow control enabled

Sending AT query..
f�������Disconnecting port COM3.

Retry connecting COM3 at 38400

Sending AT query..
f�������Disconnecting port COM3.

Retry connecting COM3 at 38400 with flow control enabled

Error: COM3 port is currently in use.
Disconnecting port COM3.

Retry connecting COM3 at 57600

Error: COM3 port is currently in use.
Disconnecting port COM3.

Retry connecting COM3 at 57600 with flow control enabled

Error: COM3 port is currently in use.
Disconnecting port COM3.

Retry connecting COM3 at 115200

Error: COM3 port is currently in use.
Disconnecting port COM3.

Retry connecting COM3 at 115200 with flow control enabled

Sending AT query..
f�������Disconnecting port COM3.

Retry connecting COM3 at 230400

Sending AT query..
f�������Disconnecting port COM3.

Retry connecting COM3 at 230400 with flow control enabled

Sending AT query..
f������� 


Invalid or no response from the device. Please check the modem port and the baud rate.Disconnecting port COM3.

 

Posted

I've given up on the "DSD TECH SH-UR01A USB Relay Controller" (which uses AT commands for control) and have gone to "Plan B", using the "SMAKN LCUS-1 type USB relay module".  Using ComUDF.au3 only, connecting and sending some hex characters using about 25 lines of code I was able to switch the contacts on and off 100% of the time, with 100% consistency.  I'm very happy with that result!

Thanks for the help, but I think either the driver or the chips on the DSD Tech SH-UR01A device are less than robust, thus the issues.

  -- Robert

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...