plcpeople / nodeS7

Node.JS library for communication to Siemens S7 PLCs
MIT License
356 stars 120 forks source link

Define the CONNECTED status and maybe provide proxy to get status in readable format. #100

Closed flacohenao closed 4 years ago

flacohenao commented 4 years ago

@gfcittolin

Right now, we have ths defined status:

image

would be nice if you guys declare the 4 (READY) status in the source code, and maybe.. if you think is usefull (I think it is) provide a method to return the status not exposing the control property

conn._connectionState

but exposing a getter instead of be able to actually set a value through that property like:

.getConnectionStatus()

that returns the "String version" of the states!

Maybe the 4 status is just for internal use?? and not need to be exposed?

if not, we can close the issue.

gfcittolin commented 4 years ago

I think what you mean by "READY" would be the CONN_CONNECTED state, right? If not, what would be the difference between them?

Note that there's already a getter called isConnected, so you could for example test it for true before trying to call other methods (or listening to the connect and disconnect events)

flacohenao commented 4 years ago

Ok, nice!

I haven't seen the isConnected getter. didn't dive on source that much I gues...