diff --git a/app/netease_control_center_common_module/mcu/mcufirmware b/app/netease_control_center_common_module/mcu/mcufirmware index 8018bb6..16fd1b8 100755 Binary files a/app/netease_control_center_common_module/mcu/mcufirmware and b/app/netease_control_center_common_module/mcu/mcufirmware differ diff --git a/app/netease_control_center_common_module/mcu/version.txt b/app/netease_control_center_common_module/mcu/version.txt index 3228857..66dc677 100755 --- a/app/netease_control_center_common_module/mcu/version.txt +++ b/app/netease_control_center_common_module/mcu/version.txt @@ -1 +1 @@ -{"version":"1.0.0.8", "md5":"76078e2fcf6ddd0ee1d31ef93a715f9f"} +{"version":"1.0.0.9", "md5":"ba700cada4fd3bd2a74c50fd6108431e"} diff --git a/app/netease_control_center_common_module/src/netease_control_center/interfaces/http/httpDatastruct.go b/app/netease_control_center_common_module/src/netease_control_center/interfaces/http/httpDatastruct.go index 3d4489d..8556f8d 100755 --- a/app/netease_control_center_common_module/src/netease_control_center/interfaces/http/httpDatastruct.go +++ b/app/netease_control_center_common_module/src/netease_control_center/interfaces/http/httpDatastruct.go @@ -13,6 +13,9 @@ const ( // server err code SERVER_RET_NIL_OR_INVALID_LIST = 4004 + + // server code,用于触发服务器的命令是否成功的返回code,成功就返回9000 + SERVER_RET_TRIG_CMD_OK = 9000 ) const ( @@ -79,7 +82,7 @@ const ( URL_Common_GetPlaylist_Rcmd = "vbox/music/common/getplaylist" //自然声获取list接口 - URL_Natual_GetPlaylist_Rcmd = "vbox/radio/nature/get" + URL_Next_Song_Get_Rcmd = "vbox/radio/nature/get" //电台detail接口 URL_Radio_Detail_Rcmd = "vbox/radio/geturl" @@ -399,9 +402,11 @@ type reqCommonGetPlayListRcmd struct { PlayMode globals.MusicPlayMode `json:"playMode"` } -type reqGetNaturalPlayListRcmd struct { - SongId string `json:"id"` - ExtraData string `json:"extraData"` +type reqGetNextSongRcmd struct { + SongId string `json:"id"` + ExtraData string `json:"extraData"` + PlaySource int `json:"playSource,omitempty"` + Cmd int `json:"cmd,omitempty"` } type reqGetRadioPlayListRcmd struct { @@ -593,7 +598,9 @@ type MusicListServerType struct { Order globals.MusicLenType //内部用,主要用于区别自然声的下一首还是获取list - NextMusic bool + TrigServer bool + Cmd int //需要当前触发服务器的命令,便于以后扩展,当前只有下一首 + Source int //play Source } //获取歌单信息 diff --git a/app/netease_control_center_common_module/src/netease_control_center/interfaces/http/httpMusic.go b/app/netease_control_center_common_module/src/netease_control_center/interfaces/http/httpMusic.go index c009f82..47f0636 100755 --- a/app/netease_control_center_common_module/src/netease_control_center/interfaces/http/httpMusic.go +++ b/app/netease_control_center_common_module/src/netease_control_center/interfaces/http/httpMusic.go @@ -48,7 +48,7 @@ func init() { RegisteApi(reqBirthdayInfo{}, ApiContainer{Url: URL_BIRTHDAY_INFO, ReqparamIsString: true, IsEncrypted: true}) RegisteApi(reqCommonGetPlayListRcmd{}, ApiContainer{Url: URL_Common_GetPlaylist_Rcmd, ReqparamIsString: true, IsEncrypted: true}) - RegisteApi(reqGetNaturalPlayListRcmd{}, ApiContainer{Url: URL_Natual_GetPlaylist_Rcmd, ReqparamIsString: true, IsEncrypted: true}) + RegisteApi(reqGetNextSongRcmd{}, ApiContainer{Url: URL_Next_Song_Get_Rcmd, ReqparamIsString: true, IsEncrypted: true}) RegisteApi(reqRadioDetailInfo{}, ApiContainer{Url: URL_Radio_Detail_Rcmd, ReqparamIsString: true, IsEncrypted: true}) RegisteApi(reqGetRadioPlayListRcmd{}, ApiContainer{Url: URL_Get_Radio_List_Rcmd, ReqparamIsString: true, IsEncrypted: true}) @@ -151,41 +151,50 @@ func GetMusicListDoNew(musicList MusicListServerType) (*ServerMusicList, int, *s var code int var detail string var err error - switch musicList.Src { - case SERVER_RCMD: - req := reqServerRcmd{PlayMode: musicList.Mode, WantTts: musicList.WantTts} - code, detail, err = postInterface(req, &res) - case SIMILAR_SONG: - req := reqSongSimilarList{Size: musicList.Size, SongId: *musicList.Id, ModeId: musicList.ModeId} - code, detail, err = postInterface(req, &res) - res.ExtraData = musicList.ExtraData - case MUSIC_SPECIAL_RCMD: - log.Println(log.WarningLog, "Get special music from server...") - req := reqMusicSpecialRcmd{Type: musicList.Src, PlayMode: musicList.Mode} - code, detail, err = postInterface(req, &res) - default: - if musicList.Src > MUSIC_COMMON_TYPE_LIST && musicList.Src < RADIO_COMMON_TYPE_LIST { - log.Println(log.WarningLog, "Get common play list from server, type Id: ", musicList.Src) - var req reqCommonGetPlayListRcmd - if musicList.Id == nil { - req = reqCommonGetPlayListRcmd{Type: musicList.Src, Size: musicList.Size, - Start: musicList.Start, ModeId: musicList.ModeId, PlayMode: musicList.Mode} - } else { - req = reqCommonGetPlayListRcmd{Type: musicList.Src, Id: *musicList.Id, Size: musicList.Size, - Start: musicList.Start, ModeId: musicList.ModeId, PlayMode: musicList.Mode} - } - code, detail, err = postInterface(req, &res) - } else if musicList.Src > RADIO_COMMON_TYPE_LIST { - log.Println(log.WarningLog, "Get radio play list from server, type Id: ", musicList.Src) - if musicList.Src == NATURAL_SOUND_LIST && musicList.NextMusic { - var req reqGetNaturalPlayListRcmd + + if musicList.TrigServer { + if int(PlayerType_Wifi) == musicList.Source { + if musicList.Src == NATURAL_SOUND_LIST { + var req reqGetNextSongRcmd if musicList.Id == nil { - req = reqGetNaturalPlayListRcmd{ExtraData: musicList.ExtraData} + req = reqGetNextSongRcmd{ExtraData: musicList.ExtraData} } else { - req = reqGetNaturalPlayListRcmd{SongId: *musicList.Id, ExtraData: musicList.ExtraData} + req = reqGetNextSongRcmd{SongId: *musicList.Id, ExtraData: musicList.ExtraData} } code, detail, err = postInterface(req, &res) - } else { + } + } else if int(PlayerType_Dlna) == musicList.Source { + var req reqGetNextSongRcmd + req = reqGetNextSongRcmd{ExtraData: musicList.ExtraData, PlaySource:musicList.Source, Cmd:musicList.Cmd} + code, detail, err = postInterface(req, &res) + } + } else { + switch musicList.Src { + case SERVER_RCMD: + req := reqServerRcmd{PlayMode: musicList.Mode, WantTts: musicList.WantTts} + code, detail, err = postInterface(req, &res) + case SIMILAR_SONG: + req := reqSongSimilarList{Size: musicList.Size, SongId: *musicList.Id, ModeId: musicList.ModeId} + code, detail, err = postInterface(req, &res) + res.ExtraData = musicList.ExtraData + case MUSIC_SPECIAL_RCMD: + log.Println(log.WarningLog, "Get special music from server...") + req := reqMusicSpecialRcmd{Type: musicList.Src, PlayMode: musicList.Mode} + code, detail, err = postInterface(req, &res) + default: + if musicList.Src > MUSIC_COMMON_TYPE_LIST && musicList.Src < RADIO_COMMON_TYPE_LIST { + log.Println(log.WarningLog, "Get common play list from server, type Id: ", musicList.Src) + var req reqCommonGetPlayListRcmd + if musicList.Id == nil { + req = reqCommonGetPlayListRcmd{Type: musicList.Src, Size: musicList.Size, + Start: musicList.Start, ModeId: musicList.ModeId, PlayMode: musicList.Mode} + } else { + req = reqCommonGetPlayListRcmd{Type: musicList.Src, Id: *musicList.Id, Size: musicList.Size, + Start: musicList.Start, ModeId: musicList.ModeId, PlayMode: musicList.Mode} + } + code, detail, err = postInterface(req, &res) + } else if musicList.Src > RADIO_COMMON_TYPE_LIST { + log.Println(log.WarningLog, "Get radio play list from server, type Id: ", musicList.Src) var req reqGetRadioPlayListRcmd if musicList.Id == nil { req = reqGetRadioPlayListRcmd{AlbumId: musicList.AlbumID, BizType: musicList.BizType, Offset: musicList.Start, Limit: musicList.Size, Order: musicList.Order, ExtraData: musicList.ExtraData} @@ -193,11 +202,10 @@ func GetMusicListDoNew(musicList MusicListServerType) (*ServerMusicList, int, *s req = reqGetRadioPlayListRcmd{SongId: *musicList.Id, AlbumId: musicList.AlbumID, BizType: musicList.BizType, Offset: musicList.Start, Limit: musicList.Size, Order: musicList.Order, ExtraData: musicList.ExtraData} } code, detail, err = postInterface(req, &res) + } else { + return getMusicListDo(musicList.Src, musicList.Id, musicList.Params, musicList.Start, musicList.Size, + musicList.Mode, musicList.ExtraData) } - - } else { - return getMusicListDo(musicList.Src, musicList.Id, musicList.Params, musicList.Start, musicList.Size, - musicList.Mode, musicList.ExtraData) } } diff --git a/app/netease_control_center_common_module/src/netease_control_center/modules/controller/mscCommand.go b/app/netease_control_center_common_module/src/netease_control_center/modules/controller/mscCommand.go index 4b7c6a9..f980f48 100755 --- a/app/netease_control_center_common_module/src/netease_control_center/modules/controller/mscCommand.go +++ b/app/netease_control_center_common_module/src/netease_control_center/modules/controller/mscCommand.go @@ -433,15 +433,44 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) { } case PlayerType_Dlna: - /*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216 + 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") + /*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216 - if retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP { - log.Println(log.WarningLog, "can not use one shot cmd :", TTS_NOT_UNSUPPORT) - http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), "下一首", TTS_NOT_UNSUPPORT) //上传信息流 + if retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP { + log.Println(log.WarningLog, "can not use one shot cmd :", TTS_NOT_UNSUPPORT) + http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), "下一首", TTS_NOT_UNSUPPORT) //上传信息流 + } else { + http.PushInfoToServerForApp(http.InfoForApp{ResponseId: retData.RspId, Cmd: retData.Cmd, Data: TTS_NOT_UNSUPPORT, Tts: TTS_NOT_UNSUPPORT, + PlayMode: CurPlayingMode, DataType: http.DATA_TYPE_STRING}) + }*/ } else { - http.PushInfoToServerForApp(http.InfoForApp{ResponseId: retData.RspId, Cmd: retData.Cmd, Data: TTS_NOT_UNSUPPORT, Tts: TTS_NOT_UNSUPPORT, - PlayMode: CurPlayingMode, DataType: http.DATA_TYPE_STRING}) - }*/ + log.Println(log.DebugLog, "one shot cmd for dlna, so trig next from server") + serverListParams := http.MusicListServerType{ + Src: MUSIC_LIST_NULL, + Id: nil, + Params: nil, + Start: 0, + Size: PAGE_SIZE, + WantTts: false, + + ExtraData: PlayListSrcRec.ExtraData, + BizType: PlayListSrcRec.BizType, + TrigServer: true, + Cmd: retData.Cmd, + Source: int(PlayerType_Dlna), + + Mode: CurPlayingMode, + } + _, 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()) + } else { + go http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), TTS_MUSIC_NEXT, TTS_MUSIC_NEXT) //上传信息流 + } + } return default: @@ -459,15 +488,44 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) { })*/ } case PlayerType_Dlna: - /*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216 + 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") + /*MscToastTts(TTS_NOT_UNSUPPORT, retData.RspId, true, false, nil) //lupeng 20190908 #PV1-4216 - if retData.Desc == MSC_CMD_ONE_SHOT || retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP { - log.Println(log.WarningLog, "can not use one shot cmd :", TTS_NOT_UNSUPPORT) - http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), "下一首", TTS_NOT_UNSUPPORT) //上传信息流 + if retData.Desc == MSC_CMD_ONE_SHOT_WAKEUP { + log.Println(log.WarningLog, "can not use one shot cmd :", TTS_NOT_UNSUPPORT) + http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), "下一首", TTS_NOT_UNSUPPORT) //上传信息流 + } else { + http.PushInfoToServerForApp(http.InfoForApp{ResponseId: retData.RspId, Cmd: retData.Cmd, Data: TTS_NOT_UNSUPPORT, Tts: TTS_NOT_UNSUPPORT, + PlayMode: CurPlayingMode, DataType: http.DATA_TYPE_STRING}) + }*/ } else { - http.PushInfoToServerForApp(http.InfoForApp{ResponseId: retData.RspId, Cmd: retData.Cmd, Data: TTS_NOT_UNSUPPORT, Tts: TTS_NOT_UNSUPPORT, - PlayMode: CurPlayingMode, DataType: http.DATA_TYPE_STRING}) - }*/ + log.Println(log.DebugLog, "one shot cmd for dlna, so trig next from server") + serverListParams := http.MusicListServerType{ + Src: MUSIC_LIST_NULL, + Id: nil, + Params: nil, + Start: 0, + Size: PAGE_SIZE, + WantTts: false, + + ExtraData: PlayListSrcRec.ExtraData, + BizType: PlayListSrcRec.BizType, + TrigServer: true, + Cmd: retData.Cmd, + Source: int(PlayerType_Dlna), + + Mode: CurPlayingMode, + } + _, 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()) + } else { + go http.InformLocalMsgToServer(http.Type_Inform_TtsPush, int(MSC_CMD_NEXT), TTS_MUSIC_NEXT, TTS_MUSIC_NEXT) //上传信息流 + } + } return default: log.Println(log.ErrorLog, "err playerId:", GetCurPlayerId()) @@ -498,7 +556,9 @@ func MscSuccessCommand(msg *[]byte, msglen uint32) { ExtraData: PlayListSrcRec.ExtraData, BizType: PlayListSrcRec.BizType, - NextMusic: true, + TrigServer: true, + Cmd: retData.Cmd, + Source: int(PlayerType_Wifi), Mode: CurPlayingMode, } diff --git a/app/netease_control_center_common_module/src/netease_control_center/modules/player/commonApi.go b/app/netease_control_center_common_module/src/netease_control_center/modules/player/commonApi.go index 433add2..4633208 100755 --- a/app/netease_control_center_common_module/src/netease_control_center/modules/player/commonApi.go +++ b/app/netease_control_center_common_module/src/netease_control_center/modules/player/commonApi.go @@ -574,6 +574,11 @@ func GetMusicListNew(playerType PlayerType, ttsNow bool, serverList http.MusicLi return nil, MusicList_ERR_MUSICINFO_NULL } + if http.SERVER_RET_TRIG_CMD_OK == code { + log.Println(log.WarningLog, "server is return OK") + return nil, nil + } + if len(err.Error()) > 0 { if ttsNow { forcePausePlayer(playerType) diff --git a/app/netease_control_center_common_module/src/netease_control_center/modules/player/dlnaPlayer.go b/app/netease_control_center_common_module/src/netease_control_center/modules/player/dlnaPlayer.go index 4eade55..ad7932f 100755 --- a/app/netease_control_center_common_module/src/netease_control_center/modules/player/dlnaPlayer.go +++ b/app/netease_control_center_common_module/src/netease_control_center/modules/player/dlnaPlayer.go @@ -420,9 +420,9 @@ func updateDlnaPlayerStatus(status PlayerDetail) uint8 { PlayerType_Dlna, precent) if MUSIC_ST_PLAYING == status.Status { - log.Printf(log.DebugLog, "%s\r", printStr) + fmt.Printf("%s\r", printStr) } else { - log.Printf(log.DebugLog, "%s\n", printStr) + fmt.Printf("%s\n", printStr) } return precent }