Comments (14)
I would completely second that. I think especially all command that only give one line as standard response could call "execute" with a parameter so that the first response line after the command is given directly to the caller as result and so these methods could parse this by themself.
Also all normal commands are "AT+Command" and the Response starts with "Command" so this also can be auto detected. This should reduce lot of complexity.
Then only a solution wuld be needed for "unknownnumer of lines" as response ... does this exist?
from serialport-gsm.
I have no idea how far you are with your refactoring plans and if someone is actively working on, I could also offer my help - but we shoukd sync that not multiple persons work on the same topic
from serialport-gsm.
Hi @Apollon77,
I almost finished the refactor.
At the step, backward compatibility and extendablity was the goal. I change the code the way that I was sure that no break would happen.
The way that you suggest sounds nice, which can be the next step. If you take a look at the code, now you can inject the logic as you suggest with no major code change. Just add a execute
function which works as you say.
Just executeCommand
and get the item
, then add the processig logic function to the item.
You can also add a listener
for processing further actions like ussd
support.
from serialport-gsm.
Ok, then I take the current GitHub code and do some stuff
from serialport-gsm.
Ahhh ok now I see your changes ... I was iterating on the "npm" code so far ;-)
This looks much better. Me personally would have it done differently, but don't matter, it works well that way. So I maybe foxus more on feature stuff. But I will gibe it a try today.
This is a huge improvement!!
from serialport-gsm.
@karianpour I think so, lots of my codes haven't been arranged well yet. Man, you're very helpful on this project, thank you so much.
from serialport-gsm.
@zabsalahid I prepared a sample refactoring, can you please check the draft pull request.
from serialport-gsm.
Hey @Apollon77 !
I would appreciate any help. At the meantime, only @karianpour is working on the project.
from serialport-gsm.
@karianpour do you do anything?! Else I would prepare a PR for discussion on the weekend ...
from serialport-gsm.
One question: Is it intended that nearly all comparisms only use "==" instead of "==="? The latter would be more type safe and such ... what are your thoughts on this? (maybe start own issue to discuss such general code style things?)
from serialport-gsm.
One question: Is it intended that nearly all comparisms only use "==" instead of "==="? The latter would be more type safe and such ... what are your thoughts on this? (maybe start own issue to discuss such general code style things?)
I agree, coding conventions and guidelines ☕️.
from serialport-gsm.
Ok, moved to : #21
from serialport-gsm.
@zabsalahid I guess that we can close this issue.
from serialport-gsm.
I will bring in some fixed with my PR today.
from serialport-gsm.
Related Issues (20)
- Receive SMS error HOT 3
- enableConcatenation not working as expected HOT 2
- How to check if modem is open or not HOT 1
- Handle multiple ports HOT 5
- Incoming USSD and message errors HOT 3
- sendSMS stuck in 1st callback when no load? HOT 14
- Failure to retrieve phone number. HOT 4
- No results found on list command HOT 9
- USB modem shows up several times when listing HOT 2
- Not receiving messages in inbox HOT 7
- USSD response HOT 4
- Compatible / Recommended USB modems HOT 1
- Wrong phone number when using sendSMS function HOT 4
- Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client HOT 7
- Port closes when sending ussd commands HOT 1
- code : "ENOENT" errno : -2 path : "udevadm" spawnargs : (2) ['info', '-e'] syscall : "spawn udevadm" [[Prototype]] : Object
- Missing Characters in a message (PDU) when sending over 160 characters HOT 9
- Error callback(undefined, new Error(`timeout: \n${JSON.stringify(item)}`))
- Is it possible to set senderID? HOT 2
- Unable to get the number of a postpaid sim using "modem.getOwnNumber(callback)" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serialport-gsm.