Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/initial Rx command option #8

Closed
wants to merge 3 commits into from
Closed

Feature/initial Rx command option #8

wants to merge 3 commits into from

Conversation

giautm
Copy link

@giautm giautm commented Jun 8, 2020

+CNMI=1,2,0,0,0 not working with my device, it said:

2020/06/08 06:35:16 /dev/ttyACM0, w: AT+CNMI=1,2,0,0,0
2020/06/08 06:35:16 /dev/ttyACM0, r:
+CMS ERROR: unknown error

I must to change command to +CNMI=1,2,0,0,1 to get it working. My device also require to initial with +CSMS=1 before send <mt>=2,3.

Parameters =2,3 and =1 are only available with GSM phase 2+ (see AT+CSMS=1). Incoming SMs or Status Reports have to be acknowledged with AT+CNMA=0 when using these phase 2+ parameters.

It can fixed, with at.WithCmds("Z", "E0", "+CSMS=1")

@coveralls
Copy link

coveralls commented Jun 8, 2020

Pull Request Test Coverage Report for Build 47

  • 5 of 11 (45.45%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.8%) to 98.466%

Changes Missing Coverage Covered Lines Changed/Added Lines %
gsm/gsm.go 5 11 45.45%
Totals Coverage Status
Change from base Build 44: -0.8%
Covered Lines: 706
Relevant Lines: 717

💛 - Coveralls

@warthog618
Copy link
Owner

I've pushed a change that allows you to set multiple init commands as an option to StartMessageRx, which allows you to fix both your problems. The default also now calls +CSMS=1, which is no doubt better than assuming it is already set.

It would be interesting to know what your modem returns to AT+CSMS?, AT+CSMS=?, AT+CNMI? and AT+CNMI=? after a reboot - it may be possible to get the driver to automatically change its defaults to suit the modem.

@giautm
Copy link
Author

giautm commented Jun 8, 2020

My modem returns

2020/06/08 16:05:49 w: AT+CSMS?
2020/06/08 16:05:49 r: 
+CSMS: 0,1,1,1
2020/06/08 16:05:49 r: 
OK
2020/06/08 16:05:49 w: AT+CSMS=?
2020/06/08 16:05:49 r: 
+CSMS: (0,1)
2020/06/08 16:05:49 r: 
OK
2020/06/08 16:05:49 w: AT+CNMI?
2020/06/08 16:05:49 r: 
+CNMI: 0,0,0,0,1
2020/06/08 16:05:49 r: 
OK
2020/06/08 16:05:49 w: AT+CNMI=?
2020/06/08 16:05:49 r: 
+CNMI: (0-3),(0,1),(0,2,3),(0,2),(1)
2020/06/08 16:05:49 r: 
OK

This is my physical device
image

@giautm giautm closed this Jun 8, 2020
@warthog618
Copy link
Owner

This is interesting:
+CNMI: (0-3),(0,1),(0,2,3),(0,2),(1)
That second param is more constrained than it should be (doesn't support 2).
Can you repeat that after a +CSMS=1?

@giautm
Copy link
Author

giautm commented Jun 8, 2020

+CNMI: (0-3),(0-3),(0,2,3),(0-2),(1)

It's changed after ran +CSMS=1. 😄

@giautm giautm deleted the feature/initial-command-option branch June 8, 2020 16:55
@warthog618
Copy link
Owner

I'll look into making StartMessageRx smarter so that you don't need to override the init commands, but I'm not sure when that will be, so hopefully you can get by with the overrides in the meantime.

@giautm
Copy link
Author

giautm commented Jun 9, 2020

I think we should don't try to do everything. Because it depend on the vendor initial commands will be different (may not follow a spec). So, flexible & simple APIs is good things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants