sync voice && cc with r16 code
This commit is contained in:
parent
8ccc4b2b1f
commit
8d682c33b5
Binary file not shown.
|
@ -1 +1 @@
|
|||
{"version":"1.0.0.9", "md5":"ba700cada4fd3bd2a74c50fd6108431e"}
|
||||
{"version":"1.0.1.1", "md5":"a8c96b3d7625adb7ab1139db6016e13d"}
|
||||
|
|
|
@ -27,4 +27,6 @@ var (
|
|||
PARAMS_ERR_INVALID = errors.New("参数异常")
|
||||
|
||||
Net_ERR_Post = errors.New("网络异常,请稍后再试")
|
||||
|
||||
Normal_Dlna_Mode = errors.New("普通dlna模式")
|
||||
)
|
||||
|
|
|
@ -42,8 +42,8 @@ var (
|
|||
OneShot OneShotArray
|
||||
WkupArray = [MaxWords]wakeupVal{
|
||||
MainWakeup: wakeupVal{WkupWord: MainWakeupWord, DayThresh: "0.52", NightThresh: "0.59", Major: "0", Dcheck: "0", DayThresh2: "0.36", NightThresh2: "0.36"},
|
||||
NextSong: wakeupVal{WkupWord: NextSongWord, DayThresh: "0.43", NightThresh: "0.49", Major: "0", Dcheck: "0", DayThresh2: "0.28", NightThresh2: "0.28"},
|
||||
VolumeAdjust: wakeupVal{WkupWord: string(VolumeUpWord + "," + VolumeDownWord), DayThresh: "0.33,0.35", NightThresh: "0.37,0.40", Major: "0,0", Dcheck: "0,0", DayThresh2: "0.25,0.23", NightThresh2: "0.25,0.23"},
|
||||
NextSong: wakeupVal{WkupWord: NextSongWord, DayThresh: "0.43", NightThresh: "0.49", Major: "0", Dcheck: "0", DayThresh2: "0.29", NightThresh2: "0.29"},
|
||||
VolumeAdjust: wakeupVal{WkupWord: string(VolumeUpWord + "," + VolumeDownWord), DayThresh: "0.34,0.34", NightThresh: "0.38,0.40", Major: "0,0", Dcheck: "0,0", DayThresh2: "0.25,0.23", NightThresh2: "0.25,0.23"},
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -144,7 +144,8 @@ const (
|
|||
APP_CMD_DEVICE_EVENT Cmd = 5152 //exec vol=0
|
||||
|
||||
APP_CMD_ENV_CHANGE Cmd = 5153
|
||||
|
||||
APP_CMD_TIMINGPAUSE_SET Cmd = 5154
|
||||
APP_CMD_TIMINGPAUSE_QUERY Cmd = 5155
|
||||
APP_CMD_CFGLIST_GET Cmd = 5998 //exec vol=0
|
||||
APP_CMD_CFGLIST_GET_RSP Cmd = 5999 //exec vol=0
|
||||
)
|
||||
|
@ -158,6 +159,9 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
MSC_CMD_YUNBOX_NEXT Cmd = 9991
|
||||
MSC_CMD_TIMINGPAUSE_SET Cmd = 9992
|
||||
MSC_CMD_TIMINGPAUSE_CANCEL Cmd = 9993
|
||||
MSC_CMD_TTS_IDLE Cmd = 9994
|
||||
)
|
||||
|
||||
|
|
|
@ -113,6 +113,10 @@ type VboxBroadcastSt struct {
|
|||
|
||||
CurTask uint8 `json:"curTask"`
|
||||
|
||||
TimingPauseSet int64 `json:"timingPauseSet,omitempty"`
|
||||
TimingPauseRemain int64 `json:"timingPauseRemain,omitempty"`
|
||||
TimingPauseOnComplete bool `json:"timingPauseOnComplete,omitempty"`
|
||||
|
||||
DeviceMode DeviceMode `json:"deviceMode"`
|
||||
|
||||
TimeStamp int64 `json:"timeStamp"`
|
||||
|
|
|
@ -12,6 +12,7 @@ const (
|
|||
Type_Inform_TtsDelay InformType = 108
|
||||
Type_Inform_TtsPush InformType = 109 //上传成对出现的tts信息流
|
||||
Type_Inform_BtOnWifiOff InformType = 110
|
||||
Type_Inform_TimingPause InformType = 111
|
||||
)
|
||||
const (
|
||||
Type_Inform_Top3_Play InformType = 104 + iota
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -256,6 +257,8 @@ func (this *HttpReq) PostAuto(reqBody interface{}, resDetail interface{}) (int,
|
|||
url = api.Url + "?aes=0"
|
||||
}
|
||||
|
||||
url += fmt.Sprintf("&t=%d", time.Now().UnixNano()/1e6)
|
||||
|
||||
if api.IsEncrypted || api.ReqparamIsString {
|
||||
data, _ := json.Marshal(reqBody)
|
||||
log.Println(log.DebugLog, "http req body:", string(data))
|
||||
|
|
|
@ -194,6 +194,9 @@ func coreSchedule(cmd SCmdStruct) {
|
|||
case PlayerArg:
|
||||
isGlobalPause = eType.GloablePause
|
||||
showIcon = !eType.NotShowIcon
|
||||
if eType.UserTrig == true {
|
||||
ClearTimeoutTimingPause()
|
||||
}
|
||||
default:
|
||||
|
||||
}
|
||||
|
@ -213,6 +216,7 @@ func coreSchedule(cmd SCmdStruct) {
|
|||
}
|
||||
eventPoint.PlayPauseEvent(eventPoint.ModelValPause, curRunningPlayer.GetPlayerStatus().Uuid)
|
||||
case SCMD_MusicPlayer_PlayOrPause:
|
||||
ClearTimeoutTimingPause()
|
||||
showIcon := false
|
||||
if len(cmd.Arg) == 1 {
|
||||
if notshow, ok := cmd.Arg[0].(bool); ok {
|
||||
|
@ -686,6 +690,7 @@ func changePlayer(from *SPlayer, to *SPlayer) {
|
|||
}
|
||||
|
||||
curRunningPlayer = to
|
||||
PlayerChangeCheckTimingPause()
|
||||
globals.ResetBroadCastTimer()
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"netease_control_center/modules/hardware/misc"
|
||||
"strings"
|
||||
"sync"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -327,6 +328,10 @@ func SetPlayerStatus(status PlayerDetail) {
|
|||
log.Println(log.ErrorLog, "Set player status, but not find the id:", status.PlayerId)
|
||||
}
|
||||
}
|
||||
|
||||
if status.Status == globals.MUSIC_ST_COMPLETED {
|
||||
TrigTimingPauseOnComplete()
|
||||
}
|
||||
}
|
||||
|
||||
func GetCurPlayerId() globals.PlayerType {
|
||||
|
@ -514,3 +519,45 @@ func TryMicAdcIdle() {
|
|||
misc.IdleMicAdc()
|
||||
}
|
||||
}
|
||||
|
||||
func GetCurDeviceMode(print bool) (ret globals.DeviceMode) {
|
||||
curPlayer := GetCurPlayer()
|
||||
if print {
|
||||
fmt.Printf("curplayer:%+v\n", *curPlayer)
|
||||
}
|
||||
if curPlayer.IsPlaying() {
|
||||
ret = globals.Exec_MusicPlay_mode
|
||||
} else {
|
||||
if !curPlayer.IsInterrupt() {
|
||||
if GetCurScheduleDomain().IsMusicDomain() == false {
|
||||
ret = globals.Exec_Non_Music_Idle_mode
|
||||
} else if globals.MUSIC_ST_PAUSED == curPlayer.GetPlayerStatus().Status {
|
||||
ret = globals.Pause_mode
|
||||
} else {
|
||||
ret = globals.Idle_mode
|
||||
}
|
||||
} else {
|
||||
// 播放器被打断过
|
||||
if curPlayer.PlayAfterResume {
|
||||
if GetCurScheduleDomain().IsMusicDomain() == true {
|
||||
ret = globals.Exec_MusicPlay_mode
|
||||
} else {
|
||||
ret = globals.Exec_Non_Music_Played_mode
|
||||
}
|
||||
} else {
|
||||
if GetCurScheduleDomain().IsMusicDomain() == false {
|
||||
ret = globals.Exec_Non_Music_Idle_mode
|
||||
} else if globals.MUSIC_ST_PAUSED == curPlayer.GetPlayerStatus().Status {
|
||||
ret = globals.Pause_mode
|
||||
} else {
|
||||
ret = globals.Idle_mode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if print {
|
||||
fmt.Printf("deviceMode:%+v, curplayer:%+v, domain:%+v\n", ret, curPlayer, GetCurScheduleDomain())
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
|
@ -19,6 +19,7 @@ type PlayerArg struct {
|
|||
NotShowIcon bool
|
||||
TtsNextPre *string
|
||||
|
||||
UserTrig bool
|
||||
ServerPlayerBase
|
||||
}
|
||||
|
||||
|
@ -303,6 +304,7 @@ func (this *SPlayer) ContinuePlay() (isSuccess bool) {
|
|||
return this.StartPlay(0)
|
||||
case difftime > GetT2Duration():
|
||||
this.Pause(true, "")
|
||||
ClearTimeoutTimingPause()
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,156 @@
|
|||
package schedule
|
||||
|
||||
import (
|
||||
"time"
|
||||
"netease_control_center/interfaces/log"
|
||||
"netease_control_center/globals"
|
||||
"fmt"
|
||||
"netease_control_center/interfaces/http"
|
||||
)
|
||||
|
||||
type TimingPauseDuration time.Duration
|
||||
|
||||
func (this TimingPauseDuration) TimeName() string {
|
||||
sec := int(time.Duration(this).Seconds())
|
||||
mins := sec / 60
|
||||
|
||||
if time.Duration(this) < time.Minute {
|
||||
return fmt.Sprintf("%d秒", sec)
|
||||
} else if time.Duration(this) < time.Hour {
|
||||
return fmt.Sprintf("%d分钟", mins)
|
||||
} else {
|
||||
if yu := mins % 60; yu == 0 {
|
||||
return fmt.Sprintf("%d小时", mins/60)
|
||||
} else {
|
||||
return fmt.Sprintf("%d小时%d分钟", mins/60, yu)
|
||||
}
|
||||
}
|
||||
}
|
||||
func (this TimingPauseDuration) Vui_Timeout() (tmp string) {
|
||||
return this.TimeName() + "的定时关闭时间到了,已为你关闭音源"
|
||||
}
|
||||
|
||||
func (this TimingPauseDuration) Vui_Cancel() string {
|
||||
return "好的,已为你取消了" + this.TimeName() + "后的定时关闭"
|
||||
}
|
||||
|
||||
func Vui_Timeout() string {
|
||||
if setDuration == 0 {
|
||||
return "你还没有设置定时关闭呢"
|
||||
} else {
|
||||
return TimingPauseDuration(setDuration).Vui_Timeout()
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
timingPause_time time.Time = time.Now()
|
||||
timingPause_timer *time.Timer = nil
|
||||
pauseOnComplete bool = false
|
||||
setDuration time.Duration
|
||||
)
|
||||
|
||||
func IstimingPauseRunning() bool {
|
||||
if pauseOnComplete == true || time.Now().Before(timingPause_time) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func GetTPTimeName() string {
|
||||
return TimingPauseDuration(setDuration).TimeName()
|
||||
}
|
||||
|
||||
func GetTimeDurationOfTimingPause() (remainMillisecond int64, IsPauseOnComplete bool, toSetMillisecond int64) {
|
||||
remain := timingPause_time.Sub(time.Now())
|
||||
if remain > 0 {
|
||||
return int64(remain.Nanoseconds() / 1e6), pauseOnComplete, int64(setDuration.Nanoseconds() / 1e6)
|
||||
} else {
|
||||
return int64(0), pauseOnComplete, int64(setDuration.Nanoseconds() / 1e6)
|
||||
}
|
||||
}
|
||||
|
||||
//player stataus trig
|
||||
func TrigTimingPauseOnComplete() {
|
||||
if pauseOnComplete == true && !time.Now().Before(timingPause_time) {
|
||||
log.Println(log.DebugLog, "Play Complete, do pause!")
|
||||
//hang dad,add delay to avoid ihwplayer bug
|
||||
time.AfterFunc(300*time.Millisecond, func() {
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: true, NotShowIcon: true})
|
||||
})
|
||||
go http.InformMsgToServer(http.Type_Inform_TimingPause, TimingPauseDuration(setDuration).Vui_Timeout())
|
||||
ClearTimingPause()
|
||||
}
|
||||
}
|
||||
|
||||
func ClearTimeoutTimingPause() {
|
||||
if pauseOnComplete == true && time.Now().After(timingPause_time) {
|
||||
ClearTimingPause()
|
||||
log.Println(log.DebugLog, "ClearTimeoutTimingPause!")
|
||||
}
|
||||
}
|
||||
|
||||
//Player change, clear player status
|
||||
func PlayerChangeCheckTimingPause() {
|
||||
if pauseOnComplete == true && !time.Now().Before(timingPause_time) {
|
||||
ClearTimingPause()
|
||||
}
|
||||
}
|
||||
|
||||
func ClearTimingPause() (vui string) {
|
||||
if now, set := time.Now(), timingPause_time; now.Before(set) {
|
||||
vui = fmt.Sprintf("好的,已为你取消了%s后的定时关闭", TimingPauseDuration(set.Sub(now)).TimeName())
|
||||
} else if pauseOnComplete {
|
||||
vui = "好的,已为你取消定时关闭"
|
||||
} else {
|
||||
vui = "你还没有设置定时关闭呢"
|
||||
}
|
||||
|
||||
pauseOnComplete = false
|
||||
if timingPause_timer != nil {
|
||||
timingPause_timer.Stop()
|
||||
}
|
||||
|
||||
timingPause_time = time.Now()
|
||||
setDuration = 0
|
||||
|
||||
globals.ResetBroadCastTimer()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func timingPauseTimeout() {
|
||||
log.Println(log.DebugLog, "TimingPause timeout!")
|
||||
if GetCurPlayerId() == globals.PlayerType_Wifi && pauseOnComplete == true {
|
||||
if GetCurDeviceMode(false).IsActive() {
|
||||
log.Println(log.DebugLog, "Cur is wifi player, wait to play complete to pause!")
|
||||
} else {
|
||||
ClearTimingPause()
|
||||
log.Println(log.DebugLog, "Player not active, stop timingPause!")
|
||||
}
|
||||
} else {
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: true, NotShowIcon: true})
|
||||
go http.InformMsgToServer(http.Type_Inform_TimingPause, TimingPauseDuration(setDuration).Vui_Timeout())
|
||||
ClearTimingPause()
|
||||
}
|
||||
}
|
||||
|
||||
func SetTimingPause(remainMillisecond *int64, IsPauseOnComplete *bool) {
|
||||
if remainMillisecond != nil {
|
||||
afterDuration := time.Duration(*remainMillisecond) * time.Millisecond
|
||||
if timingPause_timer != nil {
|
||||
timingPause_timer.Stop()
|
||||
}
|
||||
|
||||
setDuration = afterDuration
|
||||
timingPause_time = time.Now().Add(afterDuration)
|
||||
timingPause_timer = time.AfterFunc(afterDuration, timingPauseTimeout)
|
||||
}
|
||||
|
||||
if IsPauseOnComplete != nil && IstimingPauseRunning() == true {
|
||||
pauseOnComplete = *IsPauseOnComplete
|
||||
}
|
||||
log.Println(log.DebugLog, "Set timingPause:", setDuration, pauseOnComplete)
|
||||
|
||||
globals.ResetBroadCastTimer()
|
||||
}
|
|
@ -89,7 +89,7 @@ func DlnaCmdProcess(cmdid uint32, msg string) {
|
|||
//player.SetDlnaPausePhone(true)
|
||||
player.DlnaPlaySeek = true
|
||||
eventPoint.SetEpOsSouce("F141", eventPoint.EpOs_App)
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true}) // 不显示icon
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true, UserTrig:true}) // 不显示icon
|
||||
} else {
|
||||
log.Println(log.DebugLog, "dlna player is not playing, ignore pause.")
|
||||
}
|
||||
|
|
|
@ -255,6 +255,13 @@ func HTTPSERVER_test(w http.ResponseWriter, r *http.Request, ps httprouter.Param
|
|||
}
|
||||
|
||||
switch args[0] {
|
||||
case "timingpause":
|
||||
t,_ := strconv.Atoi(args[1])
|
||||
b,_ := strconv.ParseBool(args[2])
|
||||
set := int64(1000*t)
|
||||
schedule.SetTimingPause(&set, &b)
|
||||
fmt.Fprintln(w, "time:", t, " Pause On Complete:", b)
|
||||
|
||||
case "fespa_set":
|
||||
switch args[1] {
|
||||
case "once":
|
||||
|
|
|
@ -594,6 +594,9 @@ func systemServiceTaskRegiste() {
|
|||
tmp += fmt.Sprintln(" Tag:", *GitTag, " build time:", BuildDate, " Hv:", *Hv)
|
||||
tmp += fmt.Sprintln(" OemManufature:", OemManufature, " OemManufactureCheckOk:", OemManufactureCheckOk)
|
||||
tmp += fmt.Sprintln(" MicClose:", IsMicClose, "MicCloseTrig:", MicCloseTrig, "IsMicLightOn:", IsMicLightOn)
|
||||
if remain, pauseOnC,set := GetTimeDurationOfTimingPause(); true {
|
||||
tmp += fmt.Sprintln("TimingPause: remain(millisecond):", remain, " pauseOnComplete:", pauseOnC, " setTime:", set)
|
||||
}
|
||||
tmp += fmt.Sprintf(" cronMic:%+v\n", micControl)
|
||||
tmp += fmt.Sprintln(" laststatusicon:", GetLastStatusIcon())
|
||||
tmp += fmt.Sprintln(" lasticon:", GetLastIcon())
|
||||
|
|
|
@ -33,11 +33,11 @@ const (
|
|||
)
|
||||
|
||||
func MscToastLed_Before() {
|
||||
if IsMicClose == false {
|
||||
vui.IconLed_iconMusic004.Show()
|
||||
tmp := DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_START}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{uint8(adau1761.MustGetVol())})
|
||||
}
|
||||
//if IsMicClose == false {
|
||||
vui.IconLed_iconMusic004.Show()
|
||||
tmp := DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_START}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{uint8(adau1761.MustGetVol())})
|
||||
//}
|
||||
|
||||
switch nembd.Host(*ActualHv) {
|
||||
case nembd.HostPv1C:
|
||||
|
@ -65,11 +65,11 @@ func MscToastFinish(arg TtsPlayerArg) {
|
|||
|
||||
func volChangeCb(params *NoticePlayerParams) {
|
||||
params.BeforeSpecialFunc = func() {
|
||||
if IsMicClose == false {
|
||||
AlwaysShowVolumeIcon()
|
||||
tmp := DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_START}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{uint8(adau1761.MustGetVol())})
|
||||
}
|
||||
//if IsMicClose == false {
|
||||
AlwaysShowVolumeIcon()
|
||||
tmp := DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_START}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{uint8(adau1761.MustGetVol())})
|
||||
//}
|
||||
}
|
||||
params.SpecialFunc = func(arg TtsPlayerArg) {
|
||||
//if IsMicClose == false {
|
||||
|
@ -207,6 +207,34 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
|
||||
ntp.SetUnixTimeToLocal(retData.TimeStamp, 5*time.Minute, true)
|
||||
switch Cmd(retData.Cmd) {
|
||||
case MSC_CMD_TIMINGPAUSE_SET:
|
||||
backupstatus := IstimingPauseRunning()
|
||||
var toastContent string
|
||||
var tmp struct {
|
||||
Data struct{
|
||||
PauseOnComplate bool `json:"pauseOnComplate"`
|
||||
RemainTime int64 `json:"timeOffset"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
if err := json.Unmarshal([]byte(retData.Detail), &tmp); err == nil {
|
||||
SetTimingPause(&tmp.Data.RemainTime, &tmp.Data.PauseOnComplate)
|
||||
if backupstatus == true {
|
||||
toastContent = "好的,已将你的定时调整成了" + GetTPTimeName() + "后关闭"
|
||||
} else {
|
||||
toastContent = "好的,我会在" + GetTPTimeName() + "后关闭音响"
|
||||
}
|
||||
MscToastTts(toastContent, retData.RspId, true, false, nil)
|
||||
http.InformMsgToServer(http.Type_Inform_TtsDelay, toastContent)
|
||||
} else {
|
||||
log.Println(log.ErrorLog, "Decode server data err:", err)
|
||||
}
|
||||
|
||||
case MSC_CMD_TIMINGPAUSE_CANCEL:
|
||||
tts := ClearTimingPause()
|
||||
MscToastTts(tts, retData.RspId, true, false, nil)
|
||||
http.InformMsgToServer(http.Type_Inform_TtsDelay, tts)
|
||||
|
||||
case MSC_CMD_IOTWIFIPARING:
|
||||
SendSCmd(SCMD_SuperTask_Enter_IOT_WifiParing)
|
||||
|
||||
|
@ -234,7 +262,7 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
// 不显示icon
|
||||
log.Println(log.DebugLog, "pause music by chat interrupt")
|
||||
eventPoint.SetEpOsSouce("F141", eventPoint.EpOs_Server)
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true})
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true, UserTrig:true})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,6 +417,10 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
}
|
||||
}
|
||||
|
||||
case MSC_CMD_YUNBOX_NEXT:
|
||||
//yunbox mode, treat as pause, no voice and icon
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true})
|
||||
|
||||
case MSC_CMD_PAUSE:
|
||||
//SendSCmd(SCMD_MusicPlayer_Pause, nil)
|
||||
//player.SoundEffectPlayCmd(CMD_SE_PLAY, vui.SoundNotice_Scaozuofankui001.GetPath())
|
||||
|
@ -406,11 +438,11 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
vui.IconLed_IconChaozuo001.Show()
|
||||
case Exec_MusicPlay_mode:
|
||||
eventPoint.SetEpOsSouce("F141", eventPoint.EpOs_Server)
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, nil)
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true, UserTrig: true})
|
||||
case Exec_Non_Music_Played_mode:
|
||||
// 不显示icon
|
||||
eventPoint.SetEpOsSouce("F141", eventPoint.EpOs_Server)
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true})
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true, UserTrig:true})
|
||||
}
|
||||
case MSC_CMD_NEXT, MSC_CMD_PRE:
|
||||
// prd reverse : 20180316
|
||||
|
@ -445,7 +477,7 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
|
||||
case PlayerType_Dlna:
|
||||
if retData.Desc != MSC_CMD_ONE_SHOT_WAKEUP && retData.Desc != MSC_CMD_ONE_SHOT {
|
||||
log.Println(log.DebugLog, "not one shot cmd for dlna in pause mode, just return")
|
||||
log.Println(log.DebugLog, "not one shot cmd for dlna, server will deal it, so just return")
|
||||
/*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216
|
||||
|
||||
if retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP {
|
||||
|
@ -475,9 +507,11 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
}
|
||||
_, err := GetMusicListNew(PlayerType_Wifi, true, serverListParams)
|
||||
if nil != err {
|
||||
NoticePlayerSendSCmd(SCMD_SuperTask_Tts_Play, MusicErrTtsMap[string(MUSIC_LIST_NULL)], CONST_AUDIO_ID, AdSrcType_TTS,
|
||||
TTS_LEVEL_1, true, false)
|
||||
log.Println(log.ErrorLog, err.Error())
|
||||
if !strings.EqualFold(err.Error(), Normal_Dlna_Mode.Error()) {
|
||||
NoticePlayerSendSCmd(SCMD_SuperTask_Tts_Play, MusicErrTtsMap[string(MUSIC_LIST_NULL)], CONST_AUDIO_ID, AdSrcType_TTS,
|
||||
TTS_LEVEL_1, true, false)
|
||||
}
|
||||
} else {
|
||||
go http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), TTS_MUSIC_NEXT, TTS_MUSIC_NEXT) //上传信息流
|
||||
}
|
||||
|
@ -493,6 +527,7 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
case GetScenePlayerId(), PlayerType_Wifi, PlayerType_Bt, PlayerType_Airplay:
|
||||
if retData.Desc == MSC_CMD_ONE_SHOT || retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP {
|
||||
log.Println(log.DebugLog, "one shot cmd for next song")
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true, UserTrig:false})
|
||||
/*播放反馈声音,prd暂时不需要
|
||||
PlayNoticeAsync(AdSrcType_FILE, vui.SoundNotice_Shuanxing001.GetPath(), WAKEUP_AUDIO_ID, false, nil, func(id uint32, reason NoticeStopReason) {
|
||||
log.Println(log.WarningLog, "one shot cmd audio sound end")
|
||||
|
@ -500,7 +535,7 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
}
|
||||
case PlayerType_Dlna:
|
||||
if retData.Desc != MSC_CMD_ONE_SHOT_WAKEUP && retData.Desc != MSC_CMD_ONE_SHOT {
|
||||
log.Println(log.DebugLog, "not one shot cmd for dlna in pause mode, just return")
|
||||
log.Println(log.DebugLog, "not one shot cmd for dlna, server will deal it, so just return")
|
||||
/*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216
|
||||
|
||||
if retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP {
|
||||
|
@ -530,9 +565,11 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
}
|
||||
_, err := GetMusicListNew(PlayerType_Wifi, true, serverListParams)
|
||||
if nil != err {
|
||||
NoticePlayerSendSCmd(SCMD_SuperTask_Tts_Play, MusicErrTtsMap[string(MUSIC_LIST_NULL)], CONST_AUDIO_ID, AdSrcType_TTS,
|
||||
TTS_LEVEL_1, true, false)
|
||||
log.Println(log.ErrorLog, err.Error())
|
||||
if !strings.EqualFold(err.Error(), Normal_Dlna_Mode.Error()) {
|
||||
NoticePlayerSendSCmd(SCMD_SuperTask_Tts_Play, MusicErrTtsMap[string(MUSIC_LIST_NULL)], CONST_AUDIO_ID, AdSrcType_TTS,
|
||||
TTS_LEVEL_1, true, false)
|
||||
}
|
||||
} else {
|
||||
go http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), TTS_MUSIC_NEXT, TTS_MUSIC_NEXT) //上传信息流
|
||||
}
|
||||
|
@ -653,7 +690,7 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
if PlayListSrcRec.BizType != BIZ_TYPE_MUSIC {
|
||||
SendSCmd(SCMD_MusicPlayer_Play, nil)
|
||||
} else {
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true})
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{GloablePause: false, NotShowIcon: true, UserTrig:true})
|
||||
}
|
||||
|
||||
//检查是否网络缓存播放失败
|
||||
|
@ -783,11 +820,11 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
MscToastTts(tmp.Tts, retData.RspId, true, tmp.Keep, func(params *NoticePlayerParams) {
|
||||
if Cmd(retData.Cmd) == MSC_CMD_COLLECT_MUSIC {
|
||||
params.BeforeExecFunc = func() {
|
||||
if IsMicClose == false {
|
||||
vui.IconLed_IconChaozuo005.Show()
|
||||
tmp := DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_START}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{uint8(adau1761.MustGetVol())})
|
||||
}
|
||||
//if IsMicClose == false {
|
||||
vui.IconLed_IconChaozuo005.Show()
|
||||
tmp := DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_START}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{uint8(adau1761.MustGetVol())})
|
||||
//}
|
||||
|
||||
switch Cmd(retData.Cmd) {
|
||||
case MSC_CMD_COLLECT_MUSIC:
|
||||
|
@ -1394,7 +1431,11 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
DataType: http.DATA_TYPE_STRING})
|
||||
}
|
||||
|
||||
specialFuncBackup := ttsRepeatInfo.NoticePlayerParams.SpecialFunc
|
||||
ttsRepeatInfo.NoticePlayerParams.SpecialFunc = func(arg TtsPlayerArg) {
|
||||
if specialFuncBackup != nil {
|
||||
specialFuncBackup(arg)
|
||||
}
|
||||
//检查是否网络缓存播放失败
|
||||
if arg.StopReason == NoticeStopReason_Error {
|
||||
go MscToastFile(vui.SoundNotice_Song_Get_Timeout.GetPath(), CONST_AUDIO_ID, false, false, nil)
|
||||
|
@ -1495,11 +1536,13 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
return
|
||||
}
|
||||
|
||||
PlayListSrcRec.ModeId = tmp.ModeInfoDto.NewModeId
|
||||
|
||||
log.Printf(log.DebugLog, "Detail:%+v tmp:%+v\n", retData.Detail, tmp)
|
||||
SendSCmdStruct(SCmdStruct{SCmd: SCMD_MusicPlayer_Pause, Arg: []interface{}{PlayerArg{NotShowIcon: true}}, ExecCb: func(cb SCmdStructExecCb) {
|
||||
tmp := GetCurVboxBroadcastSt(false)
|
||||
tmp.PlayerStPtr.ContinuousTaskSt = MUSIC_ST_IDLE
|
||||
TrigBroadcastStatus(tmp)
|
||||
SendSCmdStruct(SCmdStruct{SCmd: SCMD_MusicPlayer_Pause, Arg: []interface{}{PlayerArg{NotShowIcon: true, UserTrig:true}}, ExecCb: func(cb SCmdStructExecCb) {
|
||||
tmpSt := GetCurVboxBroadcastSt(false)
|
||||
tmpSt.PlayerStPtr.ContinuousTaskSt = MUSIC_ST_IDLE
|
||||
TrigBroadcastStatus(tmpSt)
|
||||
ResetWifiPlayer()
|
||||
}})
|
||||
|
||||
|
@ -1550,10 +1593,44 @@ func AppSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
// return
|
||||
//}
|
||||
switch app.CmdId {
|
||||
case APP_CMD_TIMINGPAUSE_SET:
|
||||
var tmp struct {
|
||||
RemainTime *int64 `json:"timingPauseRemain"`
|
||||
TimingPauseOnComplete *bool `json:"timingPauseOnComplete"`
|
||||
Switch bool `json:"timingPauseSwitch"`
|
||||
}
|
||||
if err := json.Unmarshal([]byte(app.Detail), &tmp); err == nil {
|
||||
if tmp.Switch == true {
|
||||
SetTimingPause(tmp.RemainTime, tmp.TimingPauseOnComplete)
|
||||
} else {
|
||||
ClearTimingPause()
|
||||
}
|
||||
}
|
||||
|
||||
var tmp2 struct {
|
||||
RemainTime int64 `json:"timingPauseRemain"`
|
||||
SetTime int64 `json:"timingPauseSet"`
|
||||
TimingPauseOnComplete bool `json:"timingPauseOnComplete"`
|
||||
}
|
||||
tmp2.RemainTime, tmp2.TimingPauseOnComplete, tmp2.SetTime = GetTimeDurationOfTimingPause()
|
||||
SendCmdByYunxin(APP_CMD_TIMINGPAUSE_SET, tmp2, false, app.MsgId)
|
||||
|
||||
case APP_CMD_TIMINGPAUSE_QUERY:
|
||||
var tmp struct {
|
||||
RemainTime int64 `json:"timingPauseRemain"`
|
||||
SetTime int64 `json:"timingPauseSet"`
|
||||
TimingPauseOnComplete bool `json:"timingPauseOnComplete"`
|
||||
}
|
||||
tmp.RemainTime, tmp.TimingPauseOnComplete, tmp.SetTime = GetTimeDurationOfTimingPause()
|
||||
SendCmdByYunxin(APP_CMD_TIMINGPAUSE_QUERY, tmp, false, app.MsgId)
|
||||
|
||||
case APP_CMD_DEVICE_EVENT:
|
||||
var tmp DeviceEventStruct
|
||||
if err = json.Unmarshal([]byte(app.Detail), &tmp); err == nil {
|
||||
switch tmp.EventType {
|
||||
case DeviceEventType_QueryDevStatus:
|
||||
ResetBroadCastTimer()
|
||||
|
||||
case DeviceEventType_IotWifiParing:
|
||||
var ev DeviceEventAction
|
||||
if iot_running {
|
||||
|
@ -1561,11 +1638,12 @@ func AppSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
} else {
|
||||
ev = DeviceEventAction_End
|
||||
}
|
||||
SendEventnByYunxinWithRid(DeviceEventType_IotWifiParing, ev, app.ReplyId, false, nil)
|
||||
SendEventnByYunxinWithRid(DeviceEventType_IotWifiParing, ev, app.MsgId, false, nil)
|
||||
default:
|
||||
log.Println(log.DebugLog, "Un support event status query!", tmp.EventType)
|
||||
}
|
||||
}
|
||||
|
||||
case APP_CMD_MUSIC_PLAY:
|
||||
RestoreDefaultVolWhen0()
|
||||
if len(app.Detail) < 1 {
|
||||
|
@ -1607,12 +1685,12 @@ func AppSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
SendSCmd(SCMD_MusicPlayer_Play)
|
||||
case APP_CMD_MUSIC_PAUSE:
|
||||
eventPoint.SetEpOsSouce("F141", eventPoint.EpOs_App)
|
||||
SendSCmd(SCMD_MusicPlayer_Pause)
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{UserTrig:true})
|
||||
case APP_CMD_MUSIC_NEXT:
|
||||
RestoreDefaultVolWhen0()
|
||||
mode := getCurDeviceMode(true)
|
||||
if Exec_MusicPlay_mode == mode {
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{NotShowIcon: true})
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{NotShowIcon: true, UserTrig:false})
|
||||
}
|
||||
|
||||
base := ServerPlayerBase{Action: MUSIC_ACTION_NEXT, ActionSrc: MUSIC_ACTION_SRC_APP}
|
||||
|
@ -1624,7 +1702,7 @@ func AppSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
RestoreDefaultVolWhen0()
|
||||
mode := getCurDeviceMode(true)
|
||||
if Exec_MusicPlay_mode == mode {
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{NotShowIcon: true})
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{NotShowIcon: true, UserTrig:false})
|
||||
}
|
||||
|
||||
PlayListSrcRec.ListHasEnd = false //歌单播放结束标志位false
|
||||
|
@ -1759,7 +1837,7 @@ func AppSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
RestoreDefaultVolWhen0()
|
||||
mode := getCurDeviceMode(true)
|
||||
if Exec_MusicPlay_mode == mode {
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{NotShowIcon: true})
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{NotShowIcon: true, UserTrig:false})
|
||||
}
|
||||
|
||||
var ret struct {
|
||||
|
@ -1798,7 +1876,7 @@ func AppSuccessCommand(msg *[]byte, msglen uint32) {
|
|||
|
||||
mode := getCurDeviceMode(true)
|
||||
if Exec_MusicPlay_mode == mode {
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{NotShowIcon: true})
|
||||
SendSCmd(SCMD_MusicPlayer_Pause, PlayerArg{NotShowIcon: true, UserTrig:false})
|
||||
}
|
||||
var tmp VboxChangeInfo
|
||||
err := json.Unmarshal([]byte(app.Detail), &tmp)
|
||||
|
@ -2265,6 +2343,7 @@ func ignoreCmdInDAB() bool {
|
|||
return PlayerType_Wifi != GetCurPlayerId()
|
||||
}
|
||||
|
||||
// Deprecated: use schedule.GetCurDeviceMode instead of this
|
||||
func getCurDeviceMode(print bool) (ret DeviceMode) {
|
||||
curPlayer := GetCurPlayer()
|
||||
if print {
|
||||
|
|
|
@ -844,17 +844,17 @@ loop_finishConnectWifi:
|
|||
}
|
||||
|
||||
tmpconfig.BeforeSpecialFunc = func() {
|
||||
if IsMicClose == false {
|
||||
tmp := schedule.DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_START}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{})
|
||||
}
|
||||
//if IsMicClose == false {
|
||||
tmp := schedule.DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_START}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{})
|
||||
//}
|
||||
}
|
||||
|
||||
tmpconfig.SpecialFunc = func(arg schedule.TtsPlayerArg) {
|
||||
if IsMicClose == false {
|
||||
tmp := schedule.DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_STOP}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{})
|
||||
}
|
||||
//if IsMicClose == false {
|
||||
tmp := schedule.DirectLed{EffectId: atservice.GUIDE_EFFECT_ID_EXEC_CMD, Action: atservice.GUIDE_ACTION_STOP}
|
||||
led_mcu.DirectLedControl(tmp.EffectId, tmp.Action, tmp.StartLampNum, []byte{})
|
||||
//}
|
||||
DoOnceInit()
|
||||
}
|
||||
player.NoticePlayerSendSCmd2(schedule.SCMD_SuperTask_Tts_Ctrl_Play, tmpconfig)
|
||||
|
|
|
@ -154,7 +154,9 @@ func DbusYunxinSysMsgControl(data []byte) {
|
|||
go http.InformMsgToServer(http.Type_Inform_TtsDelay, tmp.Tts)
|
||||
}
|
||||
|
||||
specialFuncBackup := tmpconfig.SpecialFunc
|
||||
tmpconfig.SpecialFunc = func(arg schedule.TtsPlayerArg) {
|
||||
specialFuncBackup(arg)
|
||||
//检查是否网络缓存播放失败
|
||||
if arg.StopReason == schedule.NoticeStopReason_Error {
|
||||
go MscToastFile(vui.SoundNotice_Song_Get_Timeout.GetPath(), CONST_AUDIO_ID, false, false, nil)
|
||||
|
@ -254,10 +256,21 @@ func DbusYunxinSysMsgControl(data []byte) {
|
|||
case YxSCmd_ChangeAccountMode:
|
||||
log.Println(log.DebugLog, "Change account mode!")
|
||||
|
||||
schedule.SendSCmdStruct(schedule.SCmdStruct{SCmd: schedule.SCMD_MusicPlayer_Pause, Arg: []interface{}{schedule.PlayerArg{NotShowIcon: true}}, ExecCb: func(cb schedule.SCmdStructExecCb) {
|
||||
tmp := GetCurVboxBroadcastSt(false)
|
||||
tmp.PlayerStPtr.ContinuousTaskSt = MUSIC_ST_IDLE
|
||||
TrigBroadcastStatus(tmp)
|
||||
var tmp struct {
|
||||
ModeId int64 `json:"modeid"`
|
||||
}
|
||||
err := json.Unmarshal([]byte(cmd.Detail), &tmp)
|
||||
if err != nil {
|
||||
log.Println(log.ErrorLog, err.Error())
|
||||
break
|
||||
}
|
||||
|
||||
PlayListSrcRec.ModeId = tmp.ModeId
|
||||
|
||||
schedule.SendSCmdStruct(schedule.SCmdStruct{SCmd: schedule.SCMD_MusicPlayer_Pause, Arg: []interface{}{schedule.PlayerArg{NotShowIcon: true, UserTrig:true}}, ExecCb: func(cb schedule.SCmdStructExecCb) {
|
||||
tmpSt := GetCurVboxBroadcastSt(false)
|
||||
tmpSt.PlayerStPtr.ContinuousTaskSt = MUSIC_ST_IDLE
|
||||
TrigBroadcastStatus(tmpSt)
|
||||
player.ResetWifiPlayer()
|
||||
}})
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ func alarmPlay(alarm *globals.DbusAlarmRemind, canExec bool) {
|
|||
SendEventByYunxin(DeviceEventType_Alarm, DeviceEventAction_Start, map[string]interface{}{"id": alarm.Id, "timestamp": alarm.ComingTime.Unix() * 1000, "ringtimestamp": time.Now().Unix() * 1000})
|
||||
if curAlarm == nil {
|
||||
//to alarm is nil means cur no alarm ring and need backup volume!
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
time.Sleep(80 * time.Millisecond)
|
||||
preVolume, _ = adau1761.GetVol()
|
||||
if preVolume > globals.DefaultVol.GetCfgListVui() {
|
||||
VolSet(preVolume)
|
||||
|
|
|
@ -40,6 +40,8 @@ func GetCurVboxBroadcastSt(print bool) VboxBroadcastSt {
|
|||
st.DeviceMode = getCurDeviceMode(print)
|
||||
st.ModeId = PlayListSrcRec.ModeId
|
||||
|
||||
st.TimingPauseRemain,st.TimingPauseOnComplete,st.TimingPauseSet = schedule.GetTimeDurationOfTimingPause()
|
||||
|
||||
st.CurTask = uint8(schedule.GetCurScheduleDomain())
|
||||
|
||||
if st.CurrentStatus == SCENE_FIELD_ST && len(schedule.GetCurScenePlayerDetail().Uuid) == 0 {
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"netease_control_center/globals"
|
||||
"netease_control_center/interfaces"
|
||||
"netease_control_center/interfaces/log"
|
||||
"netease_control_center/interfaces/schedule"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -29,6 +30,9 @@ func BroadcastStatus(st globals.VboxBroadcastSt) {
|
|||
}
|
||||
}()
|
||||
|
||||
//final pack broadcastSt
|
||||
st.TimingPauseRemain,st.TimingPauseOnComplete, st.TimingPauseSet = schedule.GetTimeDurationOfTimingPause()
|
||||
|
||||
boxData, err := json.Marshal(st)
|
||||
if err != nil {
|
||||
log.Println(log.WarningLog, err.Error())
|
||||
|
|
|
@ -129,7 +129,7 @@ func volChangefunc(vol int) {
|
|||
|
||||
if schedule.GetCurPlayer().IsPlaying() || (schedule.GetCurPlayer().InterruptStatus && schedule.GetCurPlayer().PlayAfterResume) {
|
||||
ctrlMusicByVol = true
|
||||
schedule.SendSCmd(schedule.SCMD_MusicPlayer_Pause, nil)
|
||||
schedule.SendSCmd(schedule.SCMD_MusicPlayer_Pause, schedule.PlayerArg{UserTrig:true, NotShowIcon:true, GloablePause:true})
|
||||
}
|
||||
} else {
|
||||
CurVboxVolSt.MuteVol = false
|
||||
|
|
|
@ -108,6 +108,7 @@ const (
|
|||
DeviceEventType_Alarm DeviceEventType = 1
|
||||
DeviceEventType_FirstWifiParing DeviceEventType = 2
|
||||
DeviceEventType_IotWifiParing DeviceEventType = 3
|
||||
DeviceEventType_QueryDevStatus DeviceEventType = 4
|
||||
)
|
||||
|
||||
type DeviceEventAction int
|
||||
|
|
|
@ -176,7 +176,14 @@ func DirectLedControl(EffectId GUIDE_EFFECT_ID, Action GUIDE_ACTION, StartLampNu
|
|||
defer LastDirectLed.Lock.Unlock()
|
||||
var toShowLed DirectLed
|
||||
|
||||
toShowLed.EffectId = EffectId
|
||||
tmpEffectId := EffectId
|
||||
//执行灯目前不随声音而动,改为长亮
|
||||
if tmpEffectId == GUIDE_EFFECT_ID_EXEC_CMD {
|
||||
//log.Println(log.WarningLog, "exec cmd: EffectId = ", EffectId, ", action = ", Action)
|
||||
tmpEffectId = GUIDE_EFFECT_ID_LIGHT_CMD
|
||||
}
|
||||
|
||||
toShowLed.EffectId = tmpEffectId
|
||||
toShowLed.Action = Action
|
||||
toShowLed.StartNum = StartLampNum
|
||||
toShowLed.Data = data
|
||||
|
@ -214,6 +221,13 @@ func DirectLedClear(id GUIDE_EFFECT_ID) {
|
|||
if LastDirectLed.EffectId == GUIDE_EFFECT_ID_VOICE_INPUT {
|
||||
LastDirectLed.EffectId = GUIDE_EFFECT_ID_CLEAR
|
||||
}
|
||||
|
||||
//执行灯目前不随声音而动,改为长亮, 需要渐变退出
|
||||
if id == GUIDE_EFFECT_ID_EXEC_CMD {
|
||||
//log.Println(log.WarningLog, "DirectLedClear, EffectId = ", LastDirectLed.EffectId, ", action = ", LastDirectLed.Action)
|
||||
LastDirectLed.EffectId = GUIDE_EFFECT_ID_LIGHT_CMD
|
||||
}
|
||||
|
||||
LastDirectLed.Action = GUIDE_ACTION_STOP
|
||||
LastDirectLed.Data = []byte{}
|
||||
ShowDirectLed(LastDirectLed)
|
||||
|
|
|
@ -51,6 +51,7 @@ const (
|
|||
GUIDE_EFFECT_ID_MIC_OFF GUIDE_EFFECT_ID = 40 //禁Mic灯
|
||||
GUIDE_EFFECT_ID_VOLUME_ADJUST GUIDE_EFFECT_ID = 41
|
||||
GUIDE_EFFECT_ID_SYSTEM_ERR GUIDE_EFFECT_ID = 60 //错误灯
|
||||
GUIDE_EFFECT_ID_LIGHT_CMD GUIDE_EFFECT_ID = 66 //长亮
|
||||
GUIDE_EFFECT_ID_CLEAR GUIDE_EFFECT_ID = 163
|
||||
GUIDE_EFFECT_ID_MIC_STAT_OFF GUIDE_EFFECT_ID = 227 //mic status on/off
|
||||
GUIDE_EFFECT_ID_DO_NOTHING GUIDE_EFFECT_ID = 255
|
||||
|
|
|
@ -56,7 +56,15 @@ func uartInit() error {
|
|||
return errors.New("port open error!")
|
||||
} else {
|
||||
flushUart() //flush uart data
|
||||
sPort.Close()
|
||||
sPort, err = serial.OpenPort(c)
|
||||
if err != nil {
|
||||
log.Println(log.ErrorLog, err)
|
||||
return errors.New("port open error!")
|
||||
} else {
|
||||
flushUart() //flush uart data
|
||||
go uartReadStart()
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
|
@ -567,6 +567,12 @@ func GetMusicListNew(playerType PlayerType, ttsNow bool, serverList http.MusicLi
|
|||
}
|
||||
}()
|
||||
list, code, _, err := http.GetMusicListDoNew(serverList)
|
||||
|
||||
if int(ERR_SUCCESS) == code && serverList.Source == int(PlayerType_Dlna) {
|
||||
log.Println(log.WarningLog, "server is return OK for normal dlna")
|
||||
return nil, Normal_Dlna_Mode
|
||||
}
|
||||
|
||||
if nil != err {
|
||||
if http.SERVER_RET_NIL_OR_INVALID_LIST == code {
|
||||
log.Println(log.WarningLog, "nil music list")
|
||||
|
@ -575,7 +581,9 @@ func GetMusicListNew(playerType PlayerType, ttsNow bool, serverList http.MusicLi
|
|||
}
|
||||
|
||||
if http.SERVER_RET_TRIG_CMD_OK == code {
|
||||
log.Println(log.WarningLog, "server is return OK")
|
||||
//pause@clould music mode
|
||||
schedule.SendSCmd(schedule.SCMD_MusicPlayer_Pause, schedule.PlayerArg{GloablePause: false, NotShowIcon: true, UserTrig:false})
|
||||
log.Println(log.WarningLog, "server is return OK for clould music mode")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
@ -954,15 +962,15 @@ func mscToastFile(file string, uuid string, needRepeat bool, keep bool, configCh
|
|||
tmpconfig.IconOut = vui.IconLed_DoNothing
|
||||
|
||||
tmpconfig.BeforeSpecialFunc = func() {
|
||||
if IsMicClose == false {
|
||||
ttsExecVuiStart()
|
||||
}
|
||||
//if IsMicClose == false {
|
||||
ttsExecVuiStart()
|
||||
//}
|
||||
}
|
||||
|
||||
tmpconfig.SpecialFunc = func(arg schedule.TtsPlayerArg) {
|
||||
if IsMicClose == false {
|
||||
ttsExecVuiStop()
|
||||
}
|
||||
//if IsMicClose == false {
|
||||
ttsExecVuiStop()
|
||||
//}
|
||||
|
||||
//检查是否网络缓存播放失败
|
||||
if arg.StopReason == schedule.NoticeStopReason_Error {
|
||||
|
@ -989,15 +997,15 @@ func mscToastTts(tts string, RespId string, needRepeat bool, keep bool, configCh
|
|||
tmpconfig.IconOut = vui.IconLed_DoNothing
|
||||
|
||||
tmpconfig.BeforeSpecialFunc = func() {
|
||||
if IsMicClose == false {
|
||||
ttsExecVuiStart()
|
||||
}
|
||||
//if IsMicClose == false {
|
||||
ttsExecVuiStart()
|
||||
//}
|
||||
}
|
||||
|
||||
tmpconfig.SpecialFunc = func(arg schedule.TtsPlayerArg) {
|
||||
if IsMicClose == false {
|
||||
ttsExecVuiStop()
|
||||
}
|
||||
//if IsMicClose == false {
|
||||
ttsExecVuiStop()
|
||||
//}
|
||||
|
||||
//检查是否网络缓存播放失败
|
||||
if arg.StopReason == schedule.NoticeStopReason_Error {
|
||||
|
|
|
@ -3791,13 +3791,13 @@ func getPrepareNextAction() MusicChangeAction {
|
|||
tmpMaxpage := MusicLenType(max(int(NormalListMap[NORMAL_LIST_PAGE].MaxPage), NormalListMap[NORMAL_LIST_PAGE].List.Len()))
|
||||
|
||||
back, _ := NormalListMap[NORMAL_LIST_PAGE].GetLast()
|
||||
if nil != LocalMusicList[curMusicList].GetValidFrontBackSong(false) &&
|
||||
if MUSIC_SHARE_RCMD == PlayListSrcRec.MusicSrc { //云村推荐只有一首歌直接从服务器拉取
|
||||
ret = ACTION_ADD_LIST_MUSIC_SHARE
|
||||
} else if nil != LocalMusicList[curMusicList].GetValidFrontBackSong(false) &&
|
||||
LocalMusicList[curMusicList].GetCurPos().Value.(*SongInfo).Id != LocalMusicList[curMusicList].GetValidFrontBackSong(false).Id {
|
||||
ret = ACTION_PLAY_DIRECT
|
||||
} else if PRIVATE_FM == PlayListSrcRec.MusicSrc {
|
||||
ret = ACTION_ADD_LIST_FM
|
||||
} else if MUSIC_SHARE_RCMD == PlayListSrcRec.MusicSrc {
|
||||
ret = ACTION_ADD_LIST_MUSIC_SHARE
|
||||
} else if NormalListMap[NORMAL_LIST_PAGE].HasMore {
|
||||
// 还有分页
|
||||
ret = ACTION_NEXT_PAGE_REPLACE_LIST
|
||||
|
@ -3868,13 +3868,13 @@ func getNextPrevAction(needNextAction bool) MusicChangeAction {
|
|||
var ret MusicChangeAction
|
||||
back, _ := NormalListMap[NORMAL_LIST_PAGE].GetLast()
|
||||
if needNextAction {
|
||||
if nil != LocalMusicList[curMusicList].GetValidFrontBackSong(false) &&
|
||||
if MUSIC_SHARE_RCMD == PlayListSrcRec.MusicSrc { //云村推荐只有一首歌直接从服务器拉取
|
||||
ret = ACTION_ADD_LIST_MUSIC_SHARE
|
||||
} else if nil != LocalMusicList[curMusicList].GetValidFrontBackSong(false) &&
|
||||
LocalMusicList[curMusicList].GetCurPos().Value.(*SongInfo).Id != LocalMusicList[curMusicList].GetValidFrontBackSong(false).Id {
|
||||
ret = ACTION_PLAY_DIRECT
|
||||
} else if PRIVATE_FM == PlayListSrcRec.MusicSrc {
|
||||
ret = ACTION_ADD_LIST_FM
|
||||
} else if MUSIC_SHARE_RCMD == PlayListSrcRec.MusicSrc {
|
||||
ret = ACTION_ADD_LIST_MUSIC_SHARE
|
||||
} else if NormalListMap[NORMAL_LIST_PAGE].HasMore {
|
||||
// 还有分页
|
||||
ret = ACTION_NEXT_PAGE_REPLACE_LIST
|
||||
|
@ -3914,13 +3914,13 @@ func getNextPrevAction(needNextAction bool) MusicChangeAction {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if nil != LocalMusicList[curMusicList].GetValidFrontBackSong(true) &&
|
||||
if MUSIC_SHARE_RCMD == PlayListSrcRec.MusicSrc { //云村推荐只有一首歌直接从服务器拉取
|
||||
ret = ACTION_ADD_LIST_MUSIC_SHARE
|
||||
} else if nil != LocalMusicList[curMusicList].GetValidFrontBackSong(true) &&
|
||||
LocalMusicList[curMusicList].GetCurPos().Value.(*SongInfo).Id != LocalMusicList[curMusicList].GetValidFrontBackSong(true).Id {
|
||||
ret = ACTION_PLAY_DIRECT
|
||||
} else if PRIVATE_FM == PlayListSrcRec.MusicSrc {
|
||||
ret = ACTION_PLAY_BACK
|
||||
} else if MUSIC_SHARE_RCMD == PlayListSrcRec.MusicSrc {
|
||||
ret = ACTION_ADD_LIST_MUSIC_SHARE
|
||||
} else if NormalListMap[NORMAL_LIST_PAGE].CurPos.Value.(*PageNode).PageIndex >= 2 {
|
||||
// 前一分页
|
||||
ret = ACTION_PRE_PAGE_REPLACE_LIST
|
||||
|
|
|
@ -74,7 +74,8 @@ int Netease_audiobypass_init(struct audio_bypass **bypass, void **cae,
|
|||
(*bypass)->queue = queue_init((*bypass)->queue_buf, cap);
|
||||
(*bypass)->running = 0;
|
||||
(*bypass)->chan = chan;
|
||||
|
||||
queue_set_name((*bypass)->queue, "audiobypass");
|
||||
queue_set_debugcode((*bypass)->queue, 1);
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
@ -98,13 +99,19 @@ static void *audiobypass_read_thread(void *param) {
|
|||
char *buf = NULL;
|
||||
int bufsize = 0;
|
||||
while (bypass->running) {
|
||||
queue_set_debugcode(bypass->queue, 2);
|
||||
|
||||
bufsize = queue_read(bypass->queue, &buf);
|
||||
if (!buf)
|
||||
continue;
|
||||
|
||||
|
||||
queue_set_debugcode(bypass->queue, 3);
|
||||
if (bypass->chan & AUDIO_BYPASS_CHANNEL_MSC_IAT) {
|
||||
Netease_IAT_write(buf, bufsize);
|
||||
}
|
||||
|
||||
queue_set_debugcode(bypass->queue, 4);
|
||||
|
||||
#ifdef ENABLE_YUNXIN
|
||||
if (bypass->chan & AUDIO_BYPASS_CHANNEL_YUNXIN) {
|
||||
Netease_yunxin_writeaudio(buf, bufsize);
|
||||
|
@ -112,7 +119,9 @@ static void *audiobypass_read_thread(void *param) {
|
|||
#endif
|
||||
free(buf);
|
||||
buf = NULL;
|
||||
queue_set_debugcode(bypass->queue, 5);
|
||||
}
|
||||
queue_set_debugcode(bypass->queue, 6);
|
||||
n_debug("Audio bypass thread exit");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ void setVadStatus(VadStatus status) { vad_status = status; }
|
|||
void BaseInit() {
|
||||
memset(g_uuid, 0, sizeof(g_uuid));
|
||||
memset(g_songInfo, 0, sizeof(g_songInfo));
|
||||
g_pChipId = GetCpuSerial();
|
||||
g_pChipId = GetCpuChipId();
|
||||
pthread_mutex_init(&lock, NULL);
|
||||
}
|
||||
void BaseLock() { pthread_mutex_lock(&lock); }
|
||||
|
|
|
@ -30,10 +30,20 @@ audio_queue_t *queue_init(void *base, int capacity) {
|
|||
queue->front = 0;
|
||||
queue->rear = 0;
|
||||
queue->more = true;
|
||||
queue->debugCode = 0;
|
||||
queue->name[0] = 0;
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
void queue_set_name(audio_queue_t *queue, char *name) {
|
||||
strncpy(queue->name, name, sizeof(queue->name));
|
||||
}
|
||||
|
||||
void queue_set_debugcode(audio_queue_t *queue, int code) {
|
||||
queue->debugCode = code;
|
||||
}
|
||||
|
||||
void queue_destroy(audio_queue_t *queue) {
|
||||
if (NULL != queue) {
|
||||
pthread_mutex_destroy(&(queue->mutex));
|
||||
|
@ -164,9 +174,9 @@ int queue_read(audio_queue_t *queue, char **data) {
|
|||
|
||||
temp_buff = (char *)malloc(queueLen);
|
||||
if (NULL == temp_buff) {
|
||||
//printf("queue_read malloc error queueLen%d\n", queueLen);
|
||||
printf("queue_read malloc error queueLen%d\n", queueLen);
|
||||
pthread_mutex_unlock(&(queue->mutex));
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (queue->front + queueLen <= queue->capacity - 1) {
|
||||
|
|
|
@ -22,6 +22,8 @@ typedef struct audio_queue_t {
|
|||
int front; // 队头索引
|
||||
int rear; // 队尾索引
|
||||
int more; // 写完标记
|
||||
char name[20]; //名称
|
||||
int debugCode; //用来debug
|
||||
} audio_queue_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -64,6 +66,9 @@ void queue_set_more(audio_queue_t* queue, int more);
|
|||
|
||||
int queue_get_more(audio_queue_t* queue);
|
||||
|
||||
void queue_set_name(audio_queue_t *queue, char *name);
|
||||
|
||||
void queue_set_debugcode(audio_queue_t *queue, int code);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -38,7 +38,7 @@ enum {
|
|||
// fprintf(stderr, format, ##arg)
|
||||
|
||||
#ifdef NETEASE_TOAST
|
||||
#define n_toast(fmt, arg...) printf(fmt, ##arg)
|
||||
#define n_toast(fmt, arg...) n_printf(fmt, ##arg)
|
||||
#else
|
||||
#define n_toast(fmt, arg...) \
|
||||
do { \
|
||||
|
@ -46,7 +46,7 @@ enum {
|
|||
#endif
|
||||
|
||||
#ifdef NETEASE_DEBUG
|
||||
#define n_debug(fmt, arg...) do{printf(fmt, ##arg);}while(0)
|
||||
#define n_debug(fmt, arg...) n_printf(fmt, ##arg)
|
||||
#else
|
||||
#define n_debug(fmt, arg...) \
|
||||
do { \
|
||||
|
@ -54,7 +54,7 @@ enum {
|
|||
#endif
|
||||
|
||||
#ifdef NETEASE_ERROR
|
||||
#define n_error(fmt, arg...) printf(fmt, ##arg)
|
||||
#define n_error(fmt, arg...) n_printf(fmt, ##arg)
|
||||
#else
|
||||
#define n_error(fmt, arg...) \
|
||||
do { \
|
||||
|
|
|
@ -116,6 +116,7 @@ int netease_session_destroy(struct IAT_HD *hd);
|
|||
int netease_audio_write(const char *sessionID, const void *waveData,
|
||||
unsigned int waveLen, int audioStatus, int *epStatus,
|
||||
int *recogStatus);
|
||||
int netease_dc_wakeup_upload(char* pSession);
|
||||
const char *netease_get_result(const char *sessionID, int *rsltStatus,
|
||||
int waitTime, int *errorCode);
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ int Netease_nduilite_init(duilite_callback wakeup_callback,
|
|||
duilite_callback doa_callback,
|
||||
duilite_callback beamforming_callback,
|
||||
duilite_callback vad_callback);
|
||||
int Netease_nduilite_reinit(duilite_callback wakeup_callback,
|
||||
duilite_callback doa_callback,
|
||||
duilite_callback beamforming_callback,
|
||||
duilite_callback vad_callback);
|
||||
void Netease_nduilite_writeaudio(const void *audioData, unsigned int audio_len);
|
||||
int Netease_duilite_vad_start();
|
||||
int Netease_duilite_vad_stop(char IsLock); // 1 lock, other unlock
|
||||
|
|
|
@ -29,8 +29,7 @@ extern "C" {
|
|||
** Types
|
||||
** ------------------------------------------------------------------------ */
|
||||
typedef void* REACORD_HANDLE;
|
||||
typedef void (*recordrecord_audio_fn)(const void *audio, unsigned int audio_len, int err_code);
|
||||
typedef void (*record_audio_fn)(const void *audio, unsigned int audio_len, int err_code);
|
||||
typedef void (*record_audio_fn)(const void *audio, unsigned int audio_len, int err_code, audio_queue_t *queue);
|
||||
|
||||
|
||||
/* Configuration for a stream */
|
||||
|
|
|
@ -34,6 +34,8 @@ void Netease_yunxin_login();
|
|||
char *Netease_yunxin_dbus_getstatus();
|
||||
int Netease_yunxin_init(struct audio_bypass **bypass);
|
||||
void Netease_yunxin_writeaudio(const char *inputbuf, size_t inputsize);
|
||||
void Netease_yunxin_sendmsg_offline(char *data);
|
||||
void Netease_yunxin_sendmsg_online(char *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
|
|
@ -51,6 +51,8 @@ when who why
|
|||
/* ------------------------------------------------------------------------
|
||||
** Macros
|
||||
** ------------------------------------------------------------------------ */
|
||||
//#define BACKUP_ORIG_AUDIO
|
||||
//#define BACKUP_FINAL_AUDIO
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
** Defines
|
||||
|
@ -243,6 +245,16 @@ int Duilite_doa_cb(void *userdata, int type, char *msg, int len) {
|
|||
BaseUnlock();
|
||||
}
|
||||
json_decref(js);
|
||||
|
||||
for(int i = 0; i < sizeof(g_pQuickWkKey) / sizeof(g_pQuickWkKey[0]); i++)
|
||||
{
|
||||
if(strcmp(getVoiceWakeupword(), g_pQuickWkKey[i]) == 0)
|
||||
{
|
||||
netease_dc_wakeup_upload("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,9 +310,10 @@ static void CAEAudioCb(const void *audioData, unsigned int audioLen, int param1,
|
|||
#endif
|
||||
|
||||
static void record_audio_cb(const void *audio, unsigned int audio_len,
|
||||
int err_code) {
|
||||
int err_code, audio_queue_t *queue) {
|
||||
unsigned long long cachetime;
|
||||
|
||||
queue_set_debugcode(queue, 5);
|
||||
#ifdef DEBUG_WASTE_TIME
|
||||
Netease_caltime(&cachetime, 1);
|
||||
#endif
|
||||
|
@ -312,6 +325,7 @@ static void record_audio_cb(const void *audio, unsigned int audio_len,
|
|||
#if USED_NETEASE_FMAE
|
||||
if (1) {
|
||||
#elif USED_NETEASE_DUILITE
|
||||
queue_set_debugcode(queue, 6);
|
||||
Netease_nduilite_writeaudio(audio, audio_len);
|
||||
debug_waste_time("duilite_writeaudio", &cachetime);
|
||||
if (1) {
|
||||
|
@ -324,6 +338,7 @@ static void record_audio_cb(const void *audio, unsigned int audio_len,
|
|||
// unsigned char* pBuf = (unsigned char*)audio;
|
||||
#if 1
|
||||
if (Netease_IAT_GetStatus() == IAT_STATUS_AUDIOIN) {
|
||||
queue_set_debugcode(queue, 7);
|
||||
DCWriteAudioRec(audio, audio_len);
|
||||
debug_waste_time("DCWriteAudioRec", &cachetime);
|
||||
}
|
||||
|
@ -350,15 +365,18 @@ static void record_audio_cb(const void *audio, unsigned int audio_len,
|
|||
isSendCache = 1;
|
||||
}
|
||||
#endif
|
||||
queue_set_debugcode(queue, 8);
|
||||
__cacheCAEAudio((unsigned char *)audio, audio_len);
|
||||
debug_waste_time("__cacheCAEAudio", &cachetime);
|
||||
#endif
|
||||
|
||||
#if USED_NETEASE_FMAE && ENABLE_MODULE_XUNFEICAE
|
||||
queue_set_debugcode(queue, 9);
|
||||
ret = FMAEAudioWrite(g_hFMAE, audio, audio_len);
|
||||
|
||||
// printf("write %d at %p ret = %d\n", audio_len, audio, ret);
|
||||
#elif ENABLE_MODULE_XUNFEICAE
|
||||
queue_set_debugcode(queue, 10);
|
||||
Netease_CAEAudioWrite(caeconfig, audio, audio_len);
|
||||
#endif
|
||||
// n_debug("write finish!\n");
|
||||
|
@ -480,7 +498,7 @@ static PDBUS_MSG_PACK DBusMessageCb(uv_loop_t *pLoop, DBusConnection *pConn,
|
|||
tmp = json_dumps(js, 0);
|
||||
if (!!tmp) {
|
||||
#ifdef ENABLE_YUNXIN
|
||||
Netease_yunxin_sendmsg1(tmp);
|
||||
Netease_yunxin_sendmsg_online(tmp);
|
||||
#endif
|
||||
free(tmp);
|
||||
} else {
|
||||
|
@ -494,7 +512,7 @@ static PDBUS_MSG_PACK DBusMessageCb(uv_loop_t *pLoop, DBusConnection *pConn,
|
|||
|
||||
case CMD_YUNXIN_SENDMSG:
|
||||
#ifdef ENABLE_YUNXIN
|
||||
Netease_yunxin_sendmsg(pMsg->pMsg);
|
||||
Netease_yunxin_sendmsg_offline(pMsg->pMsg);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -515,6 +533,12 @@ static PDBUS_MSG_PACK DBusMessageCb(uv_loop_t *pLoop, DBusConnection *pConn,
|
|||
Netease_duilite_fespa_set(pMsg->pMsg);
|
||||
break;
|
||||
|
||||
case CMD_NDUILITE_SDK_REINIT:
|
||||
Netease_nduilite_reinit(Duilite_wakeup_cb, Duilite_doa_cb,
|
||||
Duilite_beforming_cb, Duilite_vad_cb);
|
||||
Netease_duilite_fespa_set(pMsg->pMsg);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -678,7 +702,7 @@ void main(int argc, char **argv) {
|
|||
n_debug("Dbus init success\n");
|
||||
} else {
|
||||
n_error("Dbus init fail: %d\n", ret);
|
||||
// return;
|
||||
return;
|
||||
}
|
||||
|
||||
#if USED_NETEASE_FMAE
|
||||
|
|
|
@ -83,6 +83,11 @@ int Netease_duilite_fespa_set(char *arg) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (1 != duiliteok) {
|
||||
n_error("duilite not ok!\n");
|
||||
return -3;
|
||||
}
|
||||
|
||||
ret = duilite_fespa_set(fespa, arg);
|
||||
n_debug("Set arg to duilite(ret=%d):%s\n", ret, arg);
|
||||
}
|
||||
|
@ -151,7 +156,7 @@ int Netease_duilite_vad_start() {
|
|||
#if USED_NETEASE_DUILITE_VAD
|
||||
int ret = -1;
|
||||
|
||||
if (NULL != duilitevad) {
|
||||
if (NULL != duilitevad && 1 == duiliteok) {
|
||||
duiliteLock("vad_start");
|
||||
if (vadstatus == 1) {
|
||||
n_debug("Begin to stop, in start!\n");
|
||||
|
@ -164,6 +169,8 @@ int Netease_duilite_vad_start() {
|
|||
duiliteUnlock("vad_start");
|
||||
return ret;
|
||||
} else {
|
||||
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n", duilitevad,
|
||||
duiliteok);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
|
@ -175,7 +182,7 @@ int Netease_duilite_vad_stop(char IsLock) {
|
|||
#if USED_NETEASE_DUILITE_VAD
|
||||
int ret = 0;
|
||||
n_debug("Begin to stop vad!\n");
|
||||
if (NULL != duilitevad) {
|
||||
if (NULL != duilitevad && 1 == duiliteok) {
|
||||
if (1 == IsLock) {
|
||||
duiliteLock(" vad_stop ");
|
||||
}
|
||||
|
@ -189,6 +196,8 @@ int Netease_duilite_vad_stop(char IsLock) {
|
|||
}
|
||||
return ret;
|
||||
} else {
|
||||
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n", duilitevad,
|
||||
duiliteok);
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
|
@ -199,7 +208,7 @@ int Netease_duilite_vad_stop(char IsLock) {
|
|||
int Neteaase_duilite_vad_cancel() {
|
||||
#if USED_NETEASE_DUILITE_VAD
|
||||
int ret = 0;
|
||||
if (NULL != duilitevad) {
|
||||
if (NULL != duilitevad && 1 == duiliteok) {
|
||||
duiliteLock(" vad_cancel ");
|
||||
if (1 == vadstatus) {
|
||||
ret = duilite_vad_cancel(duilitevad);
|
||||
|
@ -208,6 +217,9 @@ int Neteaase_duilite_vad_cancel() {
|
|||
duiliteUnlock(" vad_cancel ");
|
||||
return ret;
|
||||
} else {
|
||||
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n", duilitevad,
|
||||
duiliteok);
|
||||
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
|
@ -278,26 +290,28 @@ int Netease_nduilite_init(duilite_callback wakeup_callback,
|
|||
duilite_callback doa_callback,
|
||||
duilite_callback beamforming_callback,
|
||||
duilite_callback vad_callback) {
|
||||
int ret = 0;
|
||||
|
||||
char *auth_cfg = "{\"appKey\":\"15205715844583be\",\"secretKey\":"
|
||||
"\"e3eee41c3276bd027f2814f6cf3b8991\", "
|
||||
"\"provision\":\"/usr/share/netease/duilite/auth/"
|
||||
"aiengine-2.9.5-15205715844583be.provision\", "
|
||||
"\"serialNumber\":\"/mnt/UDISK/device.number\"}";
|
||||
|
||||
///*初始化时默认采用夜间唤醒阈值,thresh=0.64;major=0;thresh2=0.42; 时间同步成功后再根据实际时间来切换阈值*/
|
||||
char *cfg =
|
||||
"{\"aecBinPath\": "
|
||||
"\"/usr/share/netease/duilite/fespa/"
|
||||
"AEC_ch8-2-ch6_2ref_NTES_20180413_v0.9.3.bin\", "
|
||||
"\"wakeupBinPath\": "
|
||||
"\"/usr/share/netease/duilite/fespa/"
|
||||
"wakeup_aihome_ntes_20180817_pre.bin\", "
|
||||
"\"beamformingBinPath\": "
|
||||
"\"/usr/share/netease/duilite/fespa/"
|
||||
"UCA_asr_ch8-2-ch6_70mm_netease_20180425_v1.1.9.bin\", "
|
||||
"\"env\": \"words=di da di da;thresh=0.64;major=0;thresh2=0.42;\", "
|
||||
"\"rollBack\": 0}";
|
||||
|
||||
///*初始化时默认采用夜间唤醒阈值,thresh=0.59;major=0;thresh2=0.36;
|
||||
///时间同步成功后再根据实际时间来切换阈值*/
|
||||
char *cfg = "{\"aecBinPath\": "
|
||||
"\"/usr/share/netease/duilite/fespa/"
|
||||
"AEC_ch8-2-ch6_2ref_NTES_20180413_v0.9.3.bin\", "
|
||||
"\"wakeupBinPath\": "
|
||||
"\"/usr/share/netease/duilite/fespa/"
|
||||
"wakeup_aihome_ntes_20180914_pre.bin\", "
|
||||
"\"beamformingBinPath\": "
|
||||
"\"/usr/share/netease/duilite/fespa/"
|
||||
"UCA_asr_ch8-2-ch6_70mm_netease_20180425_v1.1.9.bin\", "
|
||||
"\"env\": \"words=di da di "
|
||||
"da;thresh=0.59;major=0;dcheck=0;thresh2=0.36;\", "
|
||||
"\"rollBack\": 0}";
|
||||
|
||||
#if USED_NETEASE_DUILITE_VAD
|
||||
char *vad_cfg = "{\"resBinPath\": "
|
||||
|
@ -310,8 +324,13 @@ int Netease_nduilite_init(duilite_callback wakeup_callback,
|
|||
}
|
||||
n_debug("Begin to init duilite!\n");
|
||||
|
||||
if (0 != duilite_library_load(auth_cfg)) {
|
||||
n_error("Duilite library load fail!\n");
|
||||
if (NULL == _duilitelock) {
|
||||
_duilitelock = native_mutex_create(NULL, NULL);
|
||||
}
|
||||
|
||||
ret = duilite_library_load(auth_cfg);
|
||||
if (0 != ret) {
|
||||
n_error("Duilite library load fail!(%d)\n", ret);
|
||||
return 0;
|
||||
}
|
||||
fespa = duilite_fespa_new(cfg);
|
||||
|
@ -319,6 +338,7 @@ int Netease_nduilite_init(duilite_callback wakeup_callback,
|
|||
n_debug("fespa new success!\n");
|
||||
} else {
|
||||
n_error("fespa new fail!\n");
|
||||
duilite_library_release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -327,13 +347,14 @@ int Netease_nduilite_init(duilite_callback wakeup_callback,
|
|||
oem_vad_cb = vad_callback;
|
||||
if (NULL == duilitevad) {
|
||||
n_debug("Vad new fail!\n");
|
||||
duilite_fespa_delete(fespa);
|
||||
duilite_library_release();
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
n_debug("Vad new success!\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
_duilitelock = native_mutex_create(NULL, NULL);
|
||||
duilite_fespa_register(fespa, DUILITE_CALLBACK_FESPA_WAKEUP,
|
||||
wakeup_callback, NULL);
|
||||
duilite_fespa_register(fespa, DUILITE_CALLBACK_FESPA_DOA, doa_callback,
|
||||
|
@ -394,7 +415,7 @@ void Netease_nduilite_writeaudio(const void *audioData,
|
|||
return;
|
||||
}
|
||||
|
||||
n_debug("Write nduilite data, len:%d\n", audio_len);
|
||||
//n_debug("Write nduilite data, len:%d\n", audio_len);
|
||||
ret = duilite_fespa_feed(fespa, audioData, audio_len);
|
||||
|
||||
#if 0
|
||||
|
@ -416,3 +437,29 @@ void Netease_nduilite_writeaudio(const void *audioData,
|
|||
free(newbuf);
|
||||
#endif
|
||||
}
|
||||
|
||||
int Netease_nduilite_reinit(duilite_callback wakeup_callback,
|
||||
duilite_callback doa_callback,
|
||||
duilite_callback beamforming_callback,
|
||||
duilite_callback vad_callback) {
|
||||
if (1 == duiliteok) {
|
||||
duiliteok = 0;
|
||||
n_debug("Duilite reinit sdk!\n");
|
||||
usleep(15000);
|
||||
if (NULL != fespa) {
|
||||
duilite_fespa_delete(fespa);
|
||||
fespa = NULL;
|
||||
}
|
||||
|
||||
if (NULL != duilitevad) {
|
||||
duilite_vad_delete(duilitevad);
|
||||
duilitevad = NULL;
|
||||
}
|
||||
|
||||
duilite_library_release();
|
||||
Netease_nduilite_init(wakeup_callback, doa_callback,
|
||||
beamforming_callback, vad_callback);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -45,7 +45,7 @@
|
|||
#define APP_POSTURL ("wss://vbox-asr.3.163.com/websocket")
|
||||
#endif
|
||||
|
||||
#define AISPEECH_SDK_VERSION "aispeech_1806060936"
|
||||
#define AISPEECH_SDK_VERSION "aispeech_1809201704"
|
||||
|
||||
// extern unsigned int g_bIsUsedTestServer;
|
||||
|
||||
|
@ -193,13 +193,75 @@ int netease_session_destroy(struct IAT_HD *hd) {
|
|||
|
||||
static char g_doabuf[32];
|
||||
|
||||
int netease_dc_wakeup_upload(char* pSession)
|
||||
{
|
||||
#if USED_NETEASE_DC
|
||||
json_t *js = NULL;
|
||||
char *tmpdata = NULL;
|
||||
DataColleParam dcParam;
|
||||
|
||||
char *Uuid = getUuid();
|
||||
if (Uuid[0] == '\0') {
|
||||
Netease_dbus_initargs();
|
||||
Uuid = "this is default uuid";
|
||||
}
|
||||
|
||||
DCEndSession();
|
||||
|
||||
memset(g_doabuf, 0, 32);
|
||||
// sprintf(g_doabuf, "%d", hd->angle);
|
||||
sprintf(g_doabuf, "%d", getAng());
|
||||
|
||||
dcParam.URL = GetCurServerAddr(DC_MODULE);
|
||||
|
||||
LOG_EX(LOG_Info, "DC URL: %s\n", dcParam.URL);
|
||||
// dcParam.userId = Uuid;
|
||||
// dcParam.speakerId = getChipId();
|
||||
// dcParam.sessionId = hd->sessionId;
|
||||
// dcParam.doa = g_doabuf;
|
||||
|
||||
// wakeupWord 思必驰唤醒回调提供
|
||||
// major 思必驰唤醒回调提供
|
||||
// status 思必驰唤醒回调提供
|
||||
// confidence 思必驰唤醒回调提供
|
||||
// doa 思必驰唤醒回调提供
|
||||
// sessionid 会话创建成功id号
|
||||
// wakeupsdk sdk厂家及版本
|
||||
// deviceid 音箱ID
|
||||
// userid 用户ID
|
||||
js = json_pack("{s:s, s:i, s:i, s:f, s:i, s:s, s:s, s:s, s:s}",
|
||||
"wakeupWord", getVoiceWakeupword(), "major", getVoiceMajor(),
|
||||
"status", getVoiceStatus(), "confidence",
|
||||
getVoiceConfidence(), "doa", getAng(), "sessionid",
|
||||
pSession, "wakeupsdk", AISPEECH_SDK_VERSION, "deviceid",
|
||||
getChipId(), "userid", Uuid);
|
||||
|
||||
if (js) {
|
||||
tmpdata = json_dumps(js, 0);
|
||||
if (tmpdata) {
|
||||
dcParam.info = tmpdata;
|
||||
}
|
||||
n_debug("Dc config:%s\n", tmpdata);
|
||||
json_decref(js);
|
||||
}
|
||||
|
||||
// printf("+++++++++++dcParam.doa = %s\n", dcParam.doa);
|
||||
DCStartSession(dcParam);
|
||||
|
||||
if (tmpdata) {
|
||||
free(tmpdata);
|
||||
}
|
||||
|
||||
LOG_EX(LOG_Debug, "Beging WK Data\n");
|
||||
DCWriteAudioWk(getDCCachebuf(), WAKE_CACHE_DATA_SIZE);
|
||||
LOG_EX(LOG_Debug, "End WK Data\n");
|
||||
// g_isSessionOn = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int netease_session_create(struct IAT_HD *hd, char *recType, char *confirmParam,
|
||||
char *playerStatus) {
|
||||
int errcode;
|
||||
#if USED_NETEASE_DC
|
||||
json_t *js = NULL;
|
||||
char *tmpdata;
|
||||
#endif
|
||||
SRCParam srcParam;
|
||||
|
||||
char *Uuid = getUuid();
|
||||
|
@ -296,61 +358,7 @@ int netease_session_create(struct IAT_HD *hd, char *recType, char *confirmParam,
|
|||
hd->sessionId);
|
||||
}
|
||||
|
||||
#if USED_NETEASE_DC
|
||||
|
||||
DCEndSession();
|
||||
|
||||
DataColleParam dcParam;
|
||||
|
||||
memset(g_doabuf, 0, 32);
|
||||
// sprintf(g_doabuf, "%d", hd->angle);
|
||||
sprintf(g_doabuf, "%d", getAng());
|
||||
|
||||
dcParam.URL = GetCurServerAddr(DC_MODULE);
|
||||
|
||||
LOG_EX(LOG_Info, "DC URL: %s\n", dcParam.URL);
|
||||
// dcParam.userId = Uuid;
|
||||
// dcParam.speakerId = getChipId();
|
||||
// dcParam.sessionId = hd->sessionId;
|
||||
// dcParam.doa = g_doabuf;
|
||||
|
||||
// wakeupWord 思必驰唤醒回调提供
|
||||
// major 思必驰唤醒回调提供
|
||||
// status 思必驰唤醒回调提供
|
||||
// confidence 思必驰唤醒回调提供
|
||||
// doa 思必驰唤醒回调提供
|
||||
// sessionid 会话创建成功id号
|
||||
// wakeupsdk sdk厂家及版本
|
||||
// deviceid 音箱ID
|
||||
// userid 用户ID
|
||||
js = json_pack("{s:s, s:i, s:i, s:f, s:i, s:s, s:s, s:s, s:s}",
|
||||
"wakeupWord", getVoiceWakeupword(), "major", getVoiceMajor(),
|
||||
"status", getVoiceStatus(), "confidence",
|
||||
getVoiceConfidence(), "doa", getAng(), "sessionid",
|
||||
hd->sessionId, "wakeupsdk", AISPEECH_SDK_VERSION, "deviceid",
|
||||
getChipId(), "userid", Uuid);
|
||||
|
||||
if (js) {
|
||||
tmpdata = json_dumps(js, 0);
|
||||
if (tmpdata) {
|
||||
dcParam.info = tmpdata;
|
||||
}
|
||||
n_debug("Dc config:%s\n", tmpdata);
|
||||
json_decref(js);
|
||||
}
|
||||
// printf("+++++++++++dcParam.doa = %s\n", dcParam.doa);
|
||||
DCStartSession(dcParam);
|
||||
|
||||
if (tmpdata) {
|
||||
free(tmpdata);
|
||||
}
|
||||
|
||||
LOG_EX(LOG_Debug, "Beging WK Data\n");
|
||||
DCWriteAudioWk(getDCCachebuf(), WAKE_CACHE_DATA_SIZE);
|
||||
LOG_EX(LOG_Debug, "End WK Data\n");
|
||||
// g_isSessionOn = 1;
|
||||
#endif
|
||||
|
||||
netease_dc_wakeup_upload(hd->sessionId);
|
||||
return MSP_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ static void *QueueReadThread(void *param) {
|
|||
printf("QueueReadThread record :%p\n", record);
|
||||
while (record->runing) {
|
||||
char *data_buff = NULL;
|
||||
queue_set_debugcode(record->queue, 2);
|
||||
readLen = queue_read(record->queue, &data_buff);
|
||||
if (0 == readLen) {
|
||||
printf("queue_read readLen = 0\n");
|
||||
|
@ -121,13 +122,15 @@ static void *QueueReadThread(void *param) {
|
|||
if (record->buff_size != readLen) {
|
||||
// printf("\nqueue_read readLen %d\n", readLen);
|
||||
}
|
||||
printf("\nqueue_read readLen %d\n", readLen);
|
||||
//printf("\nqueue_read readLen %d\n", readLen);
|
||||
|
||||
if (record->cb)
|
||||
record->cb(data_buff, readLen, NETEASE_SUCCESS);
|
||||
record->cb(data_buff, readLen, NETEASE_SUCCESS, record->queue);
|
||||
|
||||
free(data_buff);
|
||||
queue_set_debugcode(record->queue, 3);
|
||||
}
|
||||
queue_set_debugcode(record->queue, 4);
|
||||
printf("QueueReadThread end, running:%d \n", record->runing);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ int Netease_yunxin_checklogin() {
|
|||
return loginStatus;
|
||||
}
|
||||
|
||||
void Netease_yunxin_sendmsg(char *data) {
|
||||
void Netease_yunxin_sendmsg_offline(char *data) {
|
||||
json_t *tmp = NULL;
|
||||
char msgid[LEN_UNIXMS] = {0};
|
||||
char bduser[LEN_UUID] = {0};
|
||||
|
@ -269,15 +269,16 @@ void Netease_yunxin_sendmsg(char *data) {
|
|||
return;
|
||||
}
|
||||
|
||||
tmp = json_pack("{s:i, s:s, s:i, s:s, s:s, s:i}", kNIMMsgKeyToType,
|
||||
tmp = json_pack("{s:i, s:s, s:i, s:s, s:s, s:i, s:i}", kNIMMsgKeyToType,
|
||||
kNIMSessionTypeP2P, kNIMMsgKeyToAccount, bduser,
|
||||
kNIMMsgKeyType, kNIMMessageTypeCustom, kNIMMsgKeyBody, data,
|
||||
kNIMMsgKeyClientMsgid, msgid, kNIMMsgKeyHistorySave, 1);
|
||||
kNIMMsgKeyClientMsgid, msgid, kNIMMsgKeyHistorySave, 1,
|
||||
kNIMMsgKeySetMsgOffline, 1);
|
||||
|
||||
if (!!tmp) {
|
||||
char *body = json_dumps(tmp, 0);
|
||||
if (!!body) {
|
||||
n_toast("YunXin send msg: %s\n", body);
|
||||
n_toast("YunXin send offline msg: %s\n", body);
|
||||
nim_talk_send_msg(body, NULL, NULL, NULL);
|
||||
free(body);
|
||||
} else {
|
||||
|
@ -295,7 +296,7 @@ void Netease_yunxin_sendmsg(char *data) {
|
|||
}
|
||||
}
|
||||
|
||||
void Netease_yunxin_sendmsg1(char *data) {
|
||||
void Netease_yunxin_sendmsg_online(char *data) {
|
||||
json_t *tmp = NULL;
|
||||
char msgid[LEN_UNIXMS];
|
||||
char bduser[LEN_UUID];
|
||||
|
@ -315,15 +316,16 @@ void Netease_yunxin_sendmsg1(char *data) {
|
|||
return;
|
||||
}
|
||||
|
||||
tmp = json_pack("{s:i, s:s, s:i, s:s, s:s, s:i}", kNIMMsgKeyToType,
|
||||
tmp = json_pack("{s:i, s:s, s:i, s:s, s:s, s:i, s:i}", kNIMMsgKeyToType,
|
||||
kNIMSessionTypeP2P, kNIMMsgKeyToAccount, bduser,
|
||||
kNIMMsgKeyType, kNIMMessageTypeCustom, kNIMMsgKeyBody, data,
|
||||
kNIMMsgKeyClientMsgid, msgid, kNIMMsgKeyHistorySave, 0);
|
||||
kNIMMsgKeyClientMsgid, msgid, kNIMMsgKeyHistorySave, 0,
|
||||
kNIMMsgKeySetMsgOffline, 0);
|
||||
|
||||
if (!!tmp) {
|
||||
char *body = json_dumps(tmp, 0);
|
||||
if (!!body) {
|
||||
// n_toast("YunXin send msg: %s\n", body);
|
||||
// n_toast("YunXin send online msg: %s \n", body);
|
||||
nim_talk_send_msg(body, NULL, NULL, NULL);
|
||||
free(body);
|
||||
} else {
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue