Hello,
I have Hi3518EV300 DIY IP Camera board running recent OpenHarmony. How can I configure wifi to connect to an existing network or to set up an access point? Can I use the existing ifconfig
or hi3881
shell commands?
谢谢~
samples of hostapd
and wpa_supplicant
are in this directory: applications/sample/camera/communication
, you can edit the BUILD.gn
and hostapd/config/hostapd.conf
or wpa_supplicant/config/wpa_supplicant.conf
in this directory.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
example of BUILD.gn
:
lite_component("sample") {
features = [
"wpa_supplicant:wpa_sample", #station
"hostapd:hostapd_sample" #ap
#"wpa_cli:wpa_cli_sample" #wpa client
]
}
example of hostapd/config/hostapd.conf
:
interface=wlan0
driver=hdf wifi
ctrl_interface=udp
# name of this ap
ssid=testap
hw_mode=g
channel=1
ignore_broadcast_ssid=0
# following use wpa2-psk encrypt type
# you can omit this if going to setup an open ap
auth_algs=1
wpa=2
wpa_passphrase=12345678
rsn_pairwise=CCMP
example of wpa_supplicant/config/wpa_supplicant.conf
:
country=GB
ctrl_interface=udp
network={
#which SSID to connect to
ssid="example"
# key_mgmt=NONE if connect to an open ssid
#key_mgmt=NONE
# or use psk to suply the password of that ssid
psk="12345678"
}
Suppose the wireless interface is wlan0
, after build and burn the new image to your device, you can then execute the following command to connect to an existing network:
exec /bin/wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
or execute this command to connect to an existing network:
exec /bin/hostapd -i wlan0 /etc/hostapd.conf
hope this would be helpful.
@Caoruihong thank you very much. I will test this next week and will let you know.
登录 后才可以发表评论