[Ovmsdev] Network Manager Ideas

Mark Webb-Johnson mark at webb-johnson.net
Tue Dec 12 09:29:14 HKT 2017


I’ve had lwip pppos (via SIMCOM) running on my desk overnight, and it seems stable. Of course, we’ll need to do some fine tuning based on feedback in the field, but at least PPP connections can be brought up and down cleanly, and that is the base capability needed for more sophistication to be built on top.

The OVMS v2 client code also seems good. With DEMO car, it is not producing too much data, and seems roughly comparable to v2 usage.

For example, here is the start of one of my recent sessions (log level info):

I (17600) simcom: State: Enter PoweringOn state
I (17600) simcom: Power Cycle
I (23660) simcom: State: Enter PoweredOn state
I (42770) simcom: State: Enter MuxStart state
I (42770) gsm-mux: Start MUX
I (42780) gsm-mux: Channel #0 is open
I (42780) gsm-mux: Channel #1 is open
I (42790) gsm-mux: Channel #2 is open
I (42800) gsm-mux: Channel #3 is open
I (42810) gsm-mux: Channel #4 is open
I (43750) simcom: State: Enter NetWait state
I (53830) simcom: CREG Network Registration: RegisteredRoaming
I (54750) simcom: State: Enter NetStart state
I (55890) simcom: PPP Connection is ready to start
I (56750) simcom: State: Enter NetMode state
I (56750) gsm-ppp: Initialising...
I (59770) gsm-ppp: StatusCallBack: None
I (59770) gsm-ppp: status_cb: Connected
I (59770) gsm-ppp:    our_ipaddr  = 10.52.223.8
I (59770) gsm-ppp:    his_ipaddr  = 10.64.64.64
I (59770) gsm-ppp:    netmask     = 255.255.255.255
I (59770) gsm-ppp:    our6_ipaddr = ::
I (62570) ovms-server-v2: Status: Network connectivity established
I (62570) ovms-server-v2: Connection is api.openvehicles.com:6867 TESTCAR/...
I (63430) ovms-server-v2: Connected to OVMS Server V2 at api.openvehicles.com
I (63430) ovms-server-v2: Status: Connected to server
I (63440) ovms-server-v2: Status: Logging in...
I (63440) ovms-server-v2: Sending server login: MP-C 0 ... ... TESTCAR
I (64030) ovms-server-v2: Received welcome response MP-S 0 ... ...
I (64030) ovms-server-v2: Got server response: MP-S 0 ... ...
I (64040) ovms-server-v2: Server token is ... and digest is ...
I (64040) ovms-server-v2: Status: Server auth ok. Now priming crypto.
I (64040) ovms-server-v2: Shared secret key is .../... (44 bytes)
I (64040) ovms-server-v2: Status: OVMS V2 login successful, and crypto channel established
I (64040) ovms-server-v2: Status: Connected and logged in
I (64050) ovms-server-v2: Send MP-0 S50,K,0,0,done,standard,200,160,0,0,0,0,13,4,0,0,0,0,160.00,0,0,0,0,-1,0,0,0,0,0,400,0,0.00,400.00,100
I (64050) ovms-server-v2: Send MP-0 D0,0,5,22,30,25,0,1000000,0,61,22,0,0,0,0,0,0,0,22,0
I (64060) ovms-server-v2: Send MP-0 L22.280869,114.160599,10,30,1,0,0,0,0.0,0,0
I (64070) ovms-server-v2: Send MP-0 W30,33,40,34,30,33,40,34,0
I (64080) ovms-server-v2: Send MP-0 F3.0.0/factory/main build (idf v2.1.1-8-g5ae2c0d0) Dec 12 2017 07:55:27,DEMODEMODEMO,9,1,DEMO,CMHK Jsy Tel
I (64100) ovms-server-v2: Incoming Msg: MP-0 Z0
I (665100) ovms-server-v2: Send MP-0 S50,K,0,0,done,standard,200,160,0,0,0,0,13,4,0,0,0,0,160.00,0,0,0,0,-1,0,0,0,0,0,400,0,0.00,400.00,100
I (665110) ovms-server-v2: Send MP-0 D0,0,5,22,30,25,0,1000000,0,662,22,0,0,0,0,0,0,0,22,0
I (665120) ovms-server-v2: Send MP-0 F3.0.0/factory/main build (idf v2.1.1-8-g5ae2c0d0) Dec 12 2017 07:55:27,DEMODEMODEMO,7,1,DEMO,CMHK Jsy Tel

OVMS > server v2 status
Connected and logged in

I (1266130) ovms-server-v2: Send MP-0 S50,K,0,0,done,standard,200,160,0,0,0,0,13,4,0,0,0,0,160.00,0,0,0,0,-1,0,0,0,0,0,400,0,0.00,400.00,100
I (1266140) ovms-server-v2: Send MP-0 D0,0,5,22,30,25,0,1000000,0,1263,22,0,0,0,0,0,0,0,22,0
I (1266150) ovms-server-v2: Send MP-0 F3.0.0/factory/main build (idf v2.1.1-8-g5ae2c0d0) Dec 12 2017 07:55:27,DEMODEMODEMO,8,1,DEMO,CMHK Jsy Tel

OVMS > charge start
Charge has been started
I (1744160) ovms-server-v2: Send MP-0 S50,K,220,32,charging,standard,200,160,0,0,0,0,3,1,0,0,0,0,160.00,0,0,0,0,-1,0,0,0,0,0,400,0,-0.00,400.00,100
I (1744170) ovms-server-v2: Send MP-0 D28,0,5,22,30,25,0,1000000,0,1741,22,0,0,0,0,0,0,0,22,0
I (1867180) ovms-server-v2: Send MP-0 S51,K,220,32,charging,standard,200,160,0,2,0,0,3,1,0,0,0,0,160.00,0,0,0,0,-1,0,0,0,0,0,400,0,-0.00,400.00,100
I (1867190) ovms-server-v2: Send MP-0 D28,0,5,22,30,25,0,1000000,0,1864,22,0,0,0,0,0,0,0,22,0
I (2468200) ovms-server-v2: Send MP-0 S57,K,220,32,charging,standard,200,160,0,12,0,0,3,1,0,0,0,0,160.00,0,0,0,0,-1,0,0,0,0,0,400,0,-0.00,400.00,100
I (2468210) ovms-server-v2: Send MP-0 D28,0,5,22,30,25,0,1000000,0,2465,22,0,0,0,0,0,0,0,22,0
I (3069220) ovms-server-v2: Send MP-0 S63,K,220,32,charging,standard,200,160,0,22,0,0,3,1,0,0,0,0,160.00,0,0,0,0,-1,0,0,0,0,0,400,0,-0.00,400.00,100
I (3069230) ovms-server-v2: Send MP-0 D28,0,5,22,30,25,0,1000000,0,3066,22,0,0,0,0,0,0,0,22,0
I (3670240) ovms-server-v2: Send MP-0 S69,K,220,32,charging,standard,200,160,0,32,0,0,3,1,0,0,0,0,160.00,0,0,0,0,-1,0,0,0,0,0,400,0,-0.00,400.00,100
I (3670250) ovms-server-v2: Send MP-0 D28,0,5,22,30,25,0,1000000,0,3667,22,0,0,0,0,0,0,0,22,0

That is one set of messages every 10 minutes (the numbers in brackets after the “I” seem to be millisecond timestamps).

So, now to think about how to manage this in general. To make it easier for the end user. Here are some notes/thoughts:

We continue to use events and scripting for fine-tuned control.

For configuration, we offer options to set values and have those automatically actioned at startup. Examples:
If a vehicle type is configured, then automatically start a vehicle module of that type.
If a v2 configuration is present, then automatically start a ovms server v2 connection.

For networking, we have the network manager component. The idea here is to extend that to provide network link logic. Examples:
If wifi comes up, then sleep the simcom modem
If wifi goes down, then wake up the simcom modem

The above configuration settings can be simply mapped to v2 protocol features/parameters.

While Config parameters are currently registered and visible (MyConfig.RegisterParam), instances are not. That makes it tricky to see what config instances are available. In some of the code, we document the instances as comments after the parameter is registered. My suggestion here is to add a MyConfig.RegisterInstance to allow for instance registration (with a default value). If the instance does not exist, then it would be created with the value set as per the default. That would then make it visible to the user. The only downside to this is that the default value can’t later be changed.

What do people think? Does that make sense as an approach? Implementation should not be difficult.

Regards, Mark.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20171212/6731d716/attachment.htm>


More information about the OvmsDev mailing list