aispeech-2mic-32bit: update for wifi setting
Change-Id: I24079bca77d3b56e283546c173fa18ef52446155 Signed-off-by: Nyx Zheng <zyh@rock-chips.com>
This commit is contained in:
@ -34,23 +34,15 @@ export AISPEECH_START_CONNECT_MP3="/data/aispeech_softap_lite/audio/start_conne
|
||||
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/userdata:/userdata/bin:/data/bin:/data/bin/rk_pcba_test:/data/aispeech_softap_lite/bin
|
||||
|
||||
#if [ -f ${AISPEECH_WIFI_CFG} ]; then
|
||||
if [ -f ${AISPEECH_WIFI_CFG} ]; then
|
||||
#aispeech_player ${AISPEECH_WIFI_OK_MP3}
|
||||
# aispeech_led -m on 6
|
||||
# wpa_supplicant -B -i wlan0 -c ${AISPEECH_WIFI_CFG} &
|
||||
# dhcpcd &
|
||||
# aispeech_player ${AISPEECH_DO_CONNECT_MP3}
|
||||
#else
|
||||
# aispeech_player ${AISPEECH_NEED_CONNECT_MP3} &
|
||||
# aispeech_led -m breath 1 -s 500
|
||||
# ifconfig wlan0 down
|
||||
# aispeech_softap_server -s aiengine -p 12345678 start &
|
||||
#fi
|
||||
#aispeech_startup &
|
||||
|
||||
#/data/wifi_monitor.sh &
|
||||
|
||||
wpa_supplicant -B -i wlan0 -c /data/wpa_supplicant.conf
|
||||
|
||||
cd /oem/dds_client/demo/
|
||||
./demo_main &
|
||||
wpa_supplicant -B -i wlan0 -c ${AISPEECH_WIFI_CFG} &
|
||||
dhcpcd &
|
||||
aispeech_player ${AISPEECH_DO_CONNECT_MP3}
|
||||
else
|
||||
aispeech_player ${AISPEECH_NEED_CONNECT_MP3} &
|
||||
aispeech_softap_server -s aiengine -p 12345678 start &
|
||||
fi
|
||||
aispeech_startup &
|
||||
/data/wifi_monitor.sh &
|
||||
amixer cset name='Master Playback Volume' 90%
|
||||
|
||||
24
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/README
Executable file
24
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/README
Executable file
@ -0,0 +1,24 @@
|
||||
一、需要设置的环境变量,如果不设置使用默认值
|
||||
|
||||
//app发送的元数据,写入此文件
|
||||
export AISPEECH_DUIKIT_APP="/data/cfg/app.json"
|
||||
|
||||
//device元数据,app获取此信息
|
||||
export AISPEECH_DUIKIT_DEVICE="/data/cfg/device.json"
|
||||
|
||||
//配网文件
|
||||
export AISPEECH_WIFI_CFG="/data/cfg/wpa_supplicant.conf"
|
||||
|
||||
//服务器端口号
|
||||
export AISPEECH_SOFTAP_SERVER_PORT="8000"
|
||||
|
||||
//设备成功获取ssid和password信息,开始联网时,播放的音频
|
||||
export AISPEECH_DO_CONNECT_MP3="/data/cfg/audio/do_connect.mp3"
|
||||
|
||||
二、命令操作
|
||||
1.将aispeech_softap、aispeech_led命令的路径导出
|
||||
例如上述两个命令在目录/data/cfg/bin,需要进行如下操作
|
||||
export PATH=$PATH:/data/cfg/bin
|
||||
|
||||
开启服务器:
|
||||
aispeech_softap_server -s aiengine -p 12345678 start &
|
||||
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/connect_ok.mp3
Executable file
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/connect_ok.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/do_connect.mp3
Executable file
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/do_connect.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/need_connect.mp3
Executable file
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/need_connect.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/start_connect.mp3
Executable file
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/start_connect.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/wifi_ok.mp3
Executable file
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/audio/wifi_ok.mp3
Executable file
Binary file not shown.
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/bin/aispeech_player
Executable file
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/bin/aispeech_player
Executable file
Binary file not shown.
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/bin/aispeech_softap
Executable file
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/bin/aispeech_softap
Executable file
Binary file not shown.
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/bin/aispeech_softap_server
Executable file
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/bin/aispeech_softap_server
Executable file
Binary file not shown.
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/bin/aispeech_startup
Executable file
BIN
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/bin/aispeech_startup
Executable file
Binary file not shown.
1
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/device/app.json
Executable file
1
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/device/app.json
Executable file
@ -0,0 +1 @@
|
||||
{"name":"hahahaha"}
|
||||
11
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/device/device.json
Executable file
11
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/device/device.json
Executable file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"deviceType":"soundbox",
|
||||
"deviceName":"aispeech-rk3308-0001",
|
||||
"deviceAlias":"aispeech-rk3308-0001alias",
|
||||
"productId":"12345678",
|
||||
"deviceInfo": {
|
||||
"platform":"linux",
|
||||
"wifiMac":"12:23:ee:11:23",
|
||||
"btMac":"12:23:ee:11:23"
|
||||
}
|
||||
}
|
||||
59
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/install_v11.sh
Executable file
59
rk3308/aispeech-2mic-32bit/aispeech_softap_lite/install_v11.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
|
||||
#this script is used for rk3308 V11 board
|
||||
|
||||
dir=`pwd`
|
||||
|
||||
for item in `ls bin`; do
|
||||
chmod +x ${dir}/bin/${item}
|
||||
done
|
||||
|
||||
#hardware-related configuration
|
||||
board_startup_script=/oem/RkLunch.sh
|
||||
|
||||
rm -rf ${board_startup_script}
|
||||
|
||||
#wpa configuration file
|
||||
aispeech_wifi_cfg=/data/wpa_supplicant.conf
|
||||
|
||||
rm -rf ${aispeech_wifi_cfg}
|
||||
|
||||
content="export AISPEECH_WIFI_CFG=\"${aispeech_wifi_cfg}\"
|
||||
|
||||
#aispeech dui app information file
|
||||
export AISPEECH_DUIKIT_APP=\"${dir}/device/app.json\"
|
||||
|
||||
#aispeech dui device file
|
||||
export AISPEECH_DUIKIT_DEVICE=\"${dir}/device/device.json\"
|
||||
|
||||
#aispeech dui softap web server address
|
||||
export AISPEECH_SOFTAP_SERVER_PORT=\"8000\"
|
||||
|
||||
#aispeech dui softap configuration folder
|
||||
export AISPEECH_SOFTAP_DIR=\"/data/cfg\"
|
||||
|
||||
export AISPEECH_DO_CONNECT_MP3=\"${dir}/audio/do_connect.mp3\"
|
||||
|
||||
export AISPEECH_WIFI_OK_MP3=\"${dir}/audio/wifi_ok.mp3\"
|
||||
|
||||
export AISPEECH_NEED_CONNECT_MP3=\"${dir}/audio/need_connect.mp3\"
|
||||
|
||||
export AISPEECH_CONNECT_OK_MP3=\"${dir}/audio/connect_ok.mp3\"
|
||||
|
||||
export AISPEECH_START_CONNECT_MP3=\"${dir}/audio/start_connect.mp3\"
|
||||
|
||||
export PATH=${PATH}:${dir}/bin
|
||||
|
||||
if [ -f \${AISPEECH_WIFI_CFG} ]; then
|
||||
aispeech_player \${AISPEECH_WIFI_OK_MP3}
|
||||
wpa_supplicant -B -i wlan0 -c \${AISPEECH_WIFI_CFG} &
|
||||
dhcpcd &
|
||||
aispeech_player \${AISPEECH_DO_CONNECT_MP3}
|
||||
else
|
||||
aispeech_player \${AISPEECH_NEED_CONNECT_MP3} &
|
||||
aispeech_softap_server -s aiengine -p 12345678 start &
|
||||
fi
|
||||
aispeech_startup &
|
||||
"
|
||||
echo "${content}" > ${board_startup_script}
|
||||
|
||||
35
rk3308/aispeech-2mic-32bit/dds_client/demo/Makefile
Executable file
35
rk3308/aispeech-2mic-32bit/dds_client/demo/Makefile
Executable file
@ -0,0 +1,35 @@
|
||||
LOCAL_MODULE := demo_main
|
||||
LOCAL_SRC_FILES += main.c
|
||||
LOCAL_SRC_DIRS += json
|
||||
|
||||
LOCAL_CFLAGS := -rdynamic -g -O0 -Wall -DMG_ENABLE_THREADS -Wno-unused-variable -fPIC
|
||||
LOCAL_CFLAGS += -I.. -Ijson/ -Ibutton/ -Ibusserver/mongoose -Ibusserver/src
|
||||
|
||||
LOCAL_CFLAGS += -DRK3308_BOARD_V11
|
||||
|
||||
LOCAL_LDFLAGS += -Wl,-rpath,../
|
||||
LOCAL_LDFLAGS += -L../ -ldds_client
|
||||
|
||||
LOCAL_LDFLAGS += -Wl,-rpath,../libs/
|
||||
#LOCAL_LDFLAGS += -L../libs/ -lduilite_normal
|
||||
LOCAL_LDFLAGS += -L../libs/ -lduilite_fespl
|
||||
#LOCAL_LDFLAGS += -L../libs/ -lduilite_fespa
|
||||
LOCAL_LDFLAGS += -L../libs/ -lauth
|
||||
LOCAL_LDFLAGS += -L../libs/ -ldds
|
||||
LOCAL_LDFLAGS += -L../libs/ -laudio_play
|
||||
LOCAL_LDFLAGS += -lpthread
|
||||
LOCAL_LDFLAGS += -lasound
|
||||
|
||||
|
||||
LOCAL_CXXFLAGS := LOCAL_CFLAGS -rdynamic
|
||||
|
||||
CC = ../../../../../../buildroot/output/rockchip_rk3308_32_release/host/usr/bin/arm-rockchip-linux-gnueabihf-gcc
|
||||
|
||||
CFLAGS += $(LOCAL_CFLAGS)
|
||||
|
||||
demo_main: main.o music.o json/cJSON.o busserver/src/busserver.o busserver/mongoose/mongoose.c
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LOCAL_LDFLAGS) -lm
|
||||
|
||||
clean:
|
||||
rm -f demo_main
|
||||
rm -f *.o
|
||||
Binary file not shown.
@ -548,7 +548,7 @@ int main () {
|
||||
//pthread_create(&tid2, NULL, button_routine, NULL);
|
||||
|
||||
// 5. system init
|
||||
system("amixer cset name='Master Playback Volume' 70");
|
||||
system("amixer cset name='Master Playback Volume' 90%");
|
||||
system("chmod +x aispeech_led");
|
||||
|
||||
system("tinymix set 28 3");
|
||||
@ -561,6 +561,8 @@ int main () {
|
||||
|
||||
send_tts_update_topic();
|
||||
|
||||
system("amixer cset name='Master Playback Volume' 90%");
|
||||
|
||||
select(0, 0, 0, 0, 0);
|
||||
|
||||
dds_client_release(dc);
|
||||
|
||||
BIN
rk3308/aispeech-2mic-32bit/dds_client/demo/main.o
Executable file → Normal file
BIN
rk3308/aispeech-2mic-32bit/dds_client/demo/main.o
Executable file → Normal file
Binary file not shown.
BIN
rk3308/aispeech-2mic-32bit/dds_client/demo/music.o
Executable file → Normal file
BIN
rk3308/aispeech-2mic-32bit/dds_client/demo/music.o
Executable file → Normal file
Binary file not shown.
93
rk3308/aispeech-2mic-32bit/wifi_monitor.sh
Executable file
93
rk3308/aispeech-2mic-32bit/wifi_monitor.sh
Executable file
@ -0,0 +1,93 @@
|
||||
#!/bin/sh
|
||||
|
||||
PROCESS=/data/dds_service.sh
|
||||
|
||||
softap_stop()
|
||||
{
|
||||
echo softap_stoping
|
||||
|
||||
killall dnsmasq || echo dnsmasq-exit
|
||||
ip addr delete 192.168.1.1 dev p2p0 || echo ip-addr-delete
|
||||
killall hostapd || echo hostapd-exit
|
||||
ifconfig p2p0 down || echo p2p0
|
||||
|
||||
echo softap_stopped
|
||||
}
|
||||
|
||||
dds_start()
|
||||
{
|
||||
softap_stop
|
||||
#echo dds_start
|
||||
pidof demo_main || $PROCESS start
|
||||
|
||||
gst-play-1.0 /data/aispeech_softap_lite/audio/connect_ok.mp3
|
||||
}
|
||||
|
||||
dds_stop()
|
||||
{
|
||||
echo dds_stop
|
||||
#$PROCESS stop
|
||||
}
|
||||
wifiReadyAction()
|
||||
{
|
||||
pidof demo_main || $PROCESS start
|
||||
}
|
||||
wifiUpAction()
|
||||
{
|
||||
echo wifiUp
|
||||
dds_start
|
||||
}
|
||||
wifiDownAction()
|
||||
{
|
||||
echo wifiDown
|
||||
dds_stop
|
||||
}
|
||||
wifiChangeAction()
|
||||
{
|
||||
echo wifiChange
|
||||
dds_stop
|
||||
dds_start
|
||||
}
|
||||
wifiRequestingIp()
|
||||
{
|
||||
echo wifiRequestingIp
|
||||
}
|
||||
|
||||
checkwifistate()
|
||||
{
|
||||
local flag=0
|
||||
local last_ip_address=0
|
||||
while true
|
||||
do
|
||||
wpa_state=`wpa_cli -iwlan0 status | grep wpa_state | awk -F '=' '{printf $2}'`
|
||||
ip_address=`wpa_cli -iwlan0 status | grep ip_address | awk -F '=' '{printf $2}'`
|
||||
|
||||
if [ "${wpa_state}"x = "COMPLETED"x ];then
|
||||
if [ "${ip_address}"x != ""x ] && [ "${ip_address}"x != "0.0.0.0"x ];then
|
||||
if [ $flag -eq 0 ];then
|
||||
flag=1
|
||||
wifiUpAction
|
||||
elif [ "${ip_address}"x != "${last_ip_address}"x ];then
|
||||
flag=1
|
||||
wifiChangeAction
|
||||
else
|
||||
flag=1
|
||||
wifiReadyAction
|
||||
fi
|
||||
else
|
||||
flag=0
|
||||
wifiRequestingIp
|
||||
fi
|
||||
else
|
||||
if [ $flag -eq 1 ];then
|
||||
flag=0
|
||||
wifiDownAction
|
||||
fi
|
||||
fi
|
||||
sleep 3
|
||||
last_ip_address="${ip_address}"
|
||||
done
|
||||
}
|
||||
|
||||
$PROCESS stop
|
||||
checkwifistate
|
||||
Reference in New Issue
Block a user