- Notifications
You must be signed in to change notification settings - Fork 8.2k
samples: ocpp: add native_sim config #99455
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
base: main
Are you sure you want to change the base?
Conversation
e87d046 to a31c2de Compare a31c2de to aa87e93 Compare | CONFIG_NET_DHCPV4=n | ||
| CONFIG_NET_CONFIG_SETTINGS=y | ||
| CONFIG_NET_CONFIG_NEED_IPV4=y | ||
| CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no hard coded value please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This IP address space is reserved for documentation and we are using it in all the network samples, so these are OK to be used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted, good to know.
samples/net/ocpp/src/main.c Outdated
| struct timespec tv; | ||
| int ret; | ||
| | ||
| if (strlen(CONFIG_NET_SAMPLE_SNTP_SERVER) < 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run time error will be get down in sntp_init.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, ocpp_get_time_from_sntp would return -EINVAL before getting to sntp_init.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the change is not needed, if CONFIG_NET_SAMPLE_SNTP_SERVER not configured which will endup with run time error in sntp_init.
aa87e93 to 2729817 Compare samples/net/ocpp/src/main.c Outdated
| struct timespec tv; | ||
| int ret; | ||
| | ||
| if (strlen(CONFIG_NET_SAMPLE_SNTP_SERVER) < 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the change is not needed, if CONFIG_NET_SAMPLE_SNTP_SERVER not configured which will endup with run time error in sntp_init.
samples/net/ocpp/src/main.c Outdated
| | ||
| ocpp_get_time_from_sntp(); | ||
| ret = ocpp_get_time_from_sntp(); | ||
| if (ret < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not return even sntp unreachable.. e.g system time is maintained in RTC or some other source.
samples/net/ocpp/src/main.c Outdated
| | ||
| wait_for_network(); | ||
| | ||
| if (strlen(CONFIG_NET_SAMPLE_OCPP_SERVER) < 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, ocpp_getaddrinfo endup runtime error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason for this logic was to warn the user that ocpp server address was not configured, there could also be other reason why getaddrinfo might get fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could avoid the call to strlen() here
if (CONFIG_NET_SAMPLE_OCPP_SERVER[0] == '\0') { | CONFIG_NET_DHCPV4=n | ||
| CONFIG_NET_CONFIG_SETTINGS=y | ||
| CONFIG_NET_CONFIG_NEED_IPV4=y | ||
| CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted, good to know.
Disable DHCPv4 and use static network configuration for native_sim board Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2729817 to c5537e0 Compare |



Uh oh!
There was an error while loading. Please reload this page.