Files
Desktop_RCULogAgent/C5_MUSIC.vb
2025-12-11 11:39:02 +08:00

981 lines
38 KiB
VB.net
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Imports System.Text
Public Class C5_MUSIC
Enum MUSICFunction
Current_Playback_Status = 1 '查询当前播放状态
Set_Volume_parameters '设定音量默认参数
Specify_play_state '指定播放状态
Set_volume '设定音量
Current_Volume_parameters '查询音量默认参数
Current_Volume '查询音量
Set_cycle_mode '设定循环模式
End Enum
''' <summary>
''' C5_MUSIC类型数据
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Parsing_C5_MUSIC_DATA(data_count As Byte(), ByRef MUSIC As List(Of String)) As List(Of String)
Try
Dim C5_MUSIC As String = ""
Dim MUSIC_CMD As Byte = data_count(7)
Select Case MUSIC_CMD
Case &H20
MUSIC.Add("C5_MUSIC--查询当前播放状态")
C5_MUSIC = Current_Playback_Status(data_count, MUSIC)
Case &H30
MUSIC.Add("C5_MUSIC--查询当前播放状态")
C5_MUSIC = Current_Playback_Status(data_count, MUSIC)
Case &H21
MUSIC.Add("C5_MUSIC--设定音量默认参数")
C5_MUSIC = Set_Volume_parameters(data_count, MUSIC)
Case &H31
MUSIC.Add("C5_MUSIC--设定音量默认参数")
C5_MUSIC = Set_Volume_parameters(data_count, MUSIC)
Case &H22
MUSIC.Add("C5_MUSIC--指定播放状态")
C5_MUSIC = Specify_play_state(data_count, MUSIC)
Case &H32
MUSIC.Add("C5_MUSIC--指定播放状态")
C5_MUSIC = Specify_play_state(data_count, MUSIC)
Case &H23
MUSIC.Add("C5_MUSIC--设定音量")
C5_MUSIC = Set_volume(data_count, MUSIC)
Case &H33
MUSIC.Add("C5_MUSIC--设定音量")
C5_MUSIC = Set_volume(data_count, MUSIC)
Case &H24
MUSIC.Add("C5_MUSIC--查询音量默认参数")
C5_MUSIC = Current_Volume_parameters(data_count, MUSIC)
Case &H34
MUSIC.Add("C5_MUSIC--查询音量默认参数")
C5_MUSIC = Current_Volume_parameters(data_count, MUSIC)
Case &H26
MUSIC.Add("C5_MUSIC--查询音量")
C5_MUSIC = Current_Volume(data_count, MUSIC)
Case &H36
MUSIC.Add("C5_MUSIC--查询音量")
C5_MUSIC = Current_Volume(data_count, MUSIC)
Case &H29
MUSIC.Add("C5_MUSIC--设定循环模式")
C5_MUSIC = Set_cycle_mode(data_count, MUSIC)
Case &H39
MUSIC.Add("C5_MUSIC--设定循环模式")
C5_MUSIC = Set_cycle_mode(data_count, MUSIC)
End Select
MUSIC.Add($"{C5_MUSIC}")
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return MUSIC
End Function
#Region "C5_MUSIC数据内容解析"
#Region "查询当前播放状态"
''' <summary>
''' 查询当前播放状态
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Current_Playback_Status(data_count As Byte(), ByRef MUSIC As List(Of String)) As String
Dim str As New StringBuilder
Try
Dim direction As Byte = data_count(7)
Select Case direction
Case &H20
MUSIC.Add("发送")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh};")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh};")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh};")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh};")
End If
Case &H30
MUSIC.Add("回复")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh};")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh};")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh};")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh};")
End If
str = reply_ErrCode(data_count, str)
Case Else
MUSIC.Add("未知")
Return str.ToString
End Select
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str.ToString
End Function
''' <summary>
''' ErrCode
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function reply_ErrCode(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim errcode As Byte = data_count(8)
Select Case errcode
Case &HE0
If data_count.Count > 9 Then
MUSIC = Music_playing_state(data_count, MUSIC)
End If
Case &HE1
MUSIC.Append(" ErrCode:校验错误")
Case &HE2
MUSIC.Append(" ErrCode:命令错误")
Case &HE3
MUSIC.Append(" ErrCode:参数错误")
Case &HE4
MUSIC.Append(" ErrCode:其他错误")
Case Else
MUSIC.Append(" ErrCode:未知错误")
End Select
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return MUSIC
End Function
''' <summary>
''' 房间音乐播放状态
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Music_playing_state(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim playsingstate As Byte = data_count(9)
Select Case playsingstate
Case &H1
MUSIC.Append("播放状态:暂停;")
Case &H0
MUSIC.Append("播放状态:播放中;")
End Select
MUSIC = Music_cucle_model(data_count, MUSIC)
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
Return MUSIC
End Try
Return MUSIC
End Function
''' <summary>
''' 播放循环模式
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Music_cucle_model(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim cuclemodel As Byte = data_count(10)
Select Case cuclemodel
Case &H0
MUSIC.Append(" 播放模式:全部循环;")
Case &H1
MUSIC.Append(" 播放模式:单曲循环;")
Case &H2
MUSIC.Append(" 播放模式:文件夹循环;")
Case &H3
MUSIC.Append(" 播放模式:随机播放;")
Case &H5
MUSIC.Append(" 播放模式:顺序播放;")
End Select
MUSIC = Music_Folder_Name(data_count, MUSIC)
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
Return MUSIC
End Try
Return MUSIC
End Function
''' <summary>
''' 文件夹号
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Music_Folder_Name(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim foldername As Byte = data_count(11)
Select Case foldername
Case &H0
MUSIC.Append(" 文件夹号:音乐文件夹;")
Case &H1
MUSIC.Append(" 文件夹号:提示音文件夹;")
Case &H2
MUSIC.Append(" 文件夹号:助眠文件夹;")
Case &H3
MUSIC.Append(" 文件夹号:门铃文件夹;")
Case &H4
MUSIC.Append(" 文件夹号:欢迎词文件夹;")
End Select
Dim filename As String = Format(data_count(12), "000")
MUSIC.Append($"音乐文件名:{filename};")
MUSIC = Music_File_serialnumber(data_count, MUSIC)
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
Return MUSIC
End Try
Return MUSIC
End Function
''' <summary>
''' 文件序号
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Music_File_serialnumber(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim serialnumber_H As Byte = data_count(13)
Dim serialnumber_L As Byte = data_count(14)
MUSIC.Append($" 文件序号:{serialnumber_H + serialnumber_L};")
Music_Realtime_volume(data_count, MUSIC)
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
Return MUSIC
End Try
Return MUSIC
End Function
''' <summary>
''' 实时音量
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Music_Realtime_volume(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim volumemute_bit7 As Byte = (data_count(15) >> 7) And &H1
If volumemute_bit7 = 0 Then
MUSIC.Append(" 静音;")
ElseIf volumemute_bit7 = 1 Then
MUSIC.Append(" 未静音;")
End If
Dim volumemute_bit As Byte = data_count(15) And &H7F
MUSIC.Append($" 音量:{volumemute_bit};")
Dim Percentage_volume As Byte = data_count(16)
Dim Loop_volume1 As Byte = data_count(17)
Dim Loop_volume2 As Byte = data_count(18)
Dim Loop_volume3 As Byte = data_count(19)
MUSIC.Append($" 全局百分比音量:{Percentage_volume},")
MUSIC.Append($"音乐音量:{Loop_volume1},")
MUSIC.Append($"提示音音量:{Loop_volume2},")
MUSIC.Append($"门铃音量:{Loop_volume3};")
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
Return MUSIC
End Try
Return MUSIC
End Function
#End Region
#Region "设定音量默认参数"
''' <summary>
''' 设定音量默认参数
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Set_Volume_parameters(data_count As Byte(), ByRef MUSIC As List(Of String)) As String
Dim str As New StringBuilder
Try
Dim direction As Byte = data_count(7)
Select Case direction
Case &H21
MUSIC.Add("发送")
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh},")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh},")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh},")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh},")
End If
Dim Music_default_volume As Byte = data_count(8)
Dim Music_MAX_volume As Byte = data_count(9)
Dim Music_Min_volume As Byte = data_count(10)
str.Append($"默认音量:{Music_default_volume}")
str.Append($"最大音量:{Music_MAX_volume}")
str.Append($"最小音量:{Music_Min_volume}(不支持设置)")
str.Append($"提示音音量0")
str.Append($"门铃音量0")
Case &H31
MUSIC.Add("回复")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh}")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh}")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh}")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh}")
End If
Dim ErrCode As Byte = data_count(8)
Select Case ErrCode
Case &HE0
Case &HE1
str.Append("校验错误")
Case &HE2
str.Append("命令错误")
Case &HE3
str.Append("参数错误")
Case &HE4
str.Append("其他错误")
Case Else
str.Append("未知错误")
End Select
Case Else
End Select
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str.ToString
End Function
#End Region
#Region "指定播放状态"
''' <summary>
''' 指定播放状态
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Specify_play_state(data_count As Byte(), ByRef MUSIC As List(Of String)) As String
Dim str As New StringBuilder
Try
Dim dirction As Byte = data_count(7)
Select Case dirction
Case &H22
MUSIC.Add("发送")
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh},")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh},")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh},")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh},")
End If
Dim Music_room As Byte = data_count(8)
If Music_room = &H1 Then
str.Append("房间音乐")
Dim play_state As Byte = data_count(9)
Select Case play_state
Case &H0
str.Append("播放状态:播放;")
Case &H1
str.Append("播放状态:暂停;")
Case &H2
str.Append("播放状态:停止;")
Case &H3
str.Append("播放状态:下一曲;")
Case &H4
str.Append("播放状态:上一曲;")
Case &H5
str.Append("播放状态:快进;")
Case &H6
str.Append("播放状态:快退;")
Case &H7
str.Append("播放状态:单曲播放;")
Case &H8
str.Append("播放状态:抢先播放;")
End Select
str = Room_Folder_Name(data_count, str)
Else
str.Append("暂无此播放器")
End If
Case &H32
MUSIC.Add("回复")
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh},")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh},")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh},")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh},")
End If
Dim ErrCode As Byte = data_count(8)
Select Case ErrCode
Case &HE0
str.Append("无错误;")
Case &HE1
str.Append("校验错误;")
Case &HE2
str.Append("命令错误;")
Case &HE3
str.Append("参数错误;")
Case &HE4
str.Append("其他错误;")
Case Else
str.Append("未知错误;")
End Select
End Select
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str.ToString
End Function
''' <summary>
''' 房间音乐文件夹名
''' </summary>
''' <returns></returns>
Public Function Room_Folder_Name(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim foldername As Byte = data_count(10)
Select Case foldername
Case &H0
MUSIC.Append(" 文件夹名:音乐文件夹,")
Case &H1
MUSIC.Append(" 文件夹名:提示音文件夹,")
Case &H2
MUSIC.Append(" 文件夹名:助眠文件夹,")
Case &H3
MUSIC.Append(" 文件夹名:门铃文件夹,")
Case &H4
MUSIC.Append(" 文件夹名:欢迎词文件夹,")
Case &H5
MUSIC.Append(" 文件夹名:冥想助眠,")
Case &H6
MUSIC.Append(" 文件夹名:海浪助眠,")
Case &H7
MUSIC.Append(" 文件夹名:森林助眠,")
End Select
MUSIC = Room_File_Name(data_count, MUSIC)
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return MUSIC
End Function
''' <summary>
''' 房间音乐-文件名
''' </summary>
''' <returns></returns>
Public Function Room_File_Name(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim filename As String = Format(data_count(11), "000")
MUSIC.Append($"文件名:{filename},")
MUSIC = Room_File_Type(data_count, MUSIC)
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return MUSIC
End Function
''' <summary>
''' 房间音乐-文件类型
''' </summary>
''' <returns></returns>
Public Function Room_File_Type(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim filetype As Byte = (data_count(12) >> 7) And &H1
Select Case filetype
Case &H0
MUSIC.Append("文件类型mp3;")
Case &H1
MUSIC.Append("文件类型wav;")
End Select
MUSIC = Room_Up_volume_gradient(data_count, MUSIC)
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return MUSIC
End Function
''' <summary>
''' 上升音量渐变
''' </summary>
''' <returns></returns>
Public Function Room_Up_volume_gradient(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim Up_volume_gradient_H As Byte = data_count(13)
Dim Up_volume_gradient_L As Byte = data_count(14)
MUSIC.Append($" 助眠播放上升阶段总时间:{Up_volume_gradient_H + Up_volume_gradient_L}s,")
MUSIC = Room_Drop_volume_gradient(data_count, MUSIC)
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return MUSIC
End Function
''' <summary>
''' 下降音量渐变
''' </summary>
''' <returns></returns>
Public Function Room_Drop_volume_gradient(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim Drop_volume_gradient_H As Byte = data_count(13)
Dim Drop_volume_gradient_L As Byte = data_count(14)
MUSIC.Append($"助眠播放下降阶段总时间:{Drop_volume_gradient_H + Drop_volume_gradient_L}s,")
Dim maxvolume As Byte = data_count(15)
Dim minvolume As Byte = data_count(16)
MUSIC.Append($"助眠最高音量:{maxvolume},")
MUSIC.Append($"助眠最低音量:{minvolume};")
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return MUSIC
End Function
#End Region
#Region "设定音量"
''' <summary>
''' 设定音量
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Set_volume(data_count As Byte(), ByRef MUSIC As List(Of String)) As String
Dim str As New StringBuilder
Try
Dim volume_cmd As Byte = data_count(7)
Select Case volume_cmd
Case &H23
MUSIC.Add("发送")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh},")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh},")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh},")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh},")
End If
Dim specify_player As Byte = data_count(8)
Select Case specify_player
Case &H1
str.Append("指定播放器:房间音乐")
Case Else
End Select
str = Set_adjustment_mode(data_count, str)
Case &H33
MUSIC.Add("回复")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh},")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh},")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh},")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh},")
End If
Dim ErrCode As Byte = data_count(8)
Select Case ErrCode
Case &HE0
Case &HE1
str.Append("校验错误")
Case &HE2
str.Append("命令错误")
Case &HE3
str.Append("参数错误")
Case &HE4
str.Append("其他错误")
Case Else
str.Append("未知错误")
End Select
Case Else
End Select
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str.ToString
End Function
''' <summary>
''' 设定调节模式
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Set_adjustment_mode(data_count As Byte(), MUSIC As StringBuilder) As StringBuilder
Try
Dim mode As Byte = data_count(9)
Dim str As String() = BitConverter.ToString(data_count, 10).Split("-")
Dim Absolute_volume As String = str(0)
Dim Global_percentage As String = str(1)
Dim mute_volume As String = str(2)
Dim relative_volume As String = str(3)
Dim relative_volume_Loop As String = str(4)
Dim loop_volume1 As String = str(5)
Dim loop_volume2 As String = str(6)
Dim loop_volume3 As String = str(7)
MUSIC.Append("设定调节模式:")
MUSIC.Append($"绝对音量值:{Absolute_volume},")
MUSIC.Append($"全局百分比:{Global_percentage},")
MUSIC.Append($"静音:{mute_volume},")
MUSIC.Append($"相对音量操作:{relative_volume},")
MUSIC.Append($"相对音量操作回路:{relative_volume_Loop},")
MUSIC.Append($"音乐回路:{loop_volume1},")
MUSIC.Append($"提示音回路:{loop_volume2},")
MUSIC.Append($"门铃回路:{loop_volume3};")
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return MUSIC
End Function
#End Region
#Region "查询音量默认参数"
''' <summary>
''' 查询音量默认参数
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Current_Volume_parameters(data_count As Byte(), ByRef MUSIC As List(Of String)) As String
Dim str As New StringBuilder
Try
Dim volume_cmd As Byte = data_count(7)
Select Case volume_cmd
Case &H24
MUSIC.Add("发送")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh},")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh},")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh},")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh},")
End If
Case &H34
MUSIC.Add("回复")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh},")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh},")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh},")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh},")
End If
str = Current_Volume_ErrCode(data_count, str)
Case Else
End Select
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str.ToString
End Function
''' <summary>
''' ErrCode
''' </summary>
''' <param name="data_count"></param>
''' <param name="str"></param>
''' <returns></returns>
Public Function Current_Volume_ErrCode(data_count As Byte(), str As StringBuilder) As StringBuilder
Dim ErrCode As Byte = data_count(8)
Try
Select Case ErrCode
Case &HE0
Case &HE1
str.Append("校验错误")
Case &HE2
str.Append("命令错误")
Case &HE3
str.Append("参数错误")
Case &HE4
str.Append("其他错误")
Case Else
str.Append("未知错误")
End Select
Dim defaultvolume As String = $"默认音量:{data_count(9)},"
Dim maxvolume As String = $"最大音量:{data_count(10)},"
Dim minvolume As String = $"最小音量:{data_count(11)},"
Dim promptvolume As String = $"提示音音量:{data_count(12)},"
Dim doorbellvolume As String = $"门铃音量:{data_count(13)};"
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str
End Function
#End Region
#Region "查询音量"
''' <summary>
''' 查询音量
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Current_Volume(data_count As Byte(), ByRef MUSIC As List(Of String)) As String
Dim str As New StringBuilder
Try
Dim direction As Byte = data_count(7)
Select Case direction
Case &H26
MUSIC.Add("发送")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh};")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh};")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh};")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh};")
End If
Case &H36
MUSIC.Add("回复")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh};")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh};")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh};")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh};")
End If
Dim ErrCode As Byte = data_count(8)
Select Case ErrCode
Case &HE0
Case &HE1
str.Append("校验错误")
Case &HE2
str.Append("命令错误")
Case &HE3
str.Append("参数错误")
Case &HE4
str.Append("其他错误")
End Select
Dim currentvolume As Byte = $" 当前音量:{data_count(9)};"
End Select
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str.ToString
End Function
#End Region
#Region "设定循环模式"
''' <summary>
''' 设定循环模式
''' </summary>
''' <param name="data_count"></param>
''' <param name="MUSIC"></param>
''' <returns></returns>
Public Function Set_cycle_mode(data_count As Byte(), ByRef MUSIC As List(Of String)) As String
Dim str As New StringBuilder
Try
Dim direction As Byte = data_count(7)
Select Case direction
Case &H29
MUSIC.Add("发送")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh};")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh};")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh};")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh};")
End If
str = Set_cycle_mode_Specify_player(data_count, str)
Case &H39
MUSIC.Add("回复")
Dim Playback_Type As Byte = data_count(1)
Dim v As Byte = (data_count(1) >> 6) And &H3
Dim xh As Byte = data_count(1) And &HF
If v = &H0 Then
str.Append($"(首发,单发)发送序号:{xh};")
ElseIf v = &H1 Then
str.Append($"(首发,群发)发送序号:{xh};")
ElseIf v = &H2 Then
str.Append($"(重发,单发)发送序号:{xh};")
ElseIf v = &H3 Then
str.Append($"(重发,群发)发送序号:{xh};")
End If
Dim ErrCode As Byte = data_count(8)
Select Case ErrCode
Case &HE0
str.Append("无错误;")
Case &HE1
str.Append("校验错误")
Case &HE2
str.Append("命令错误")
Case Else
End Select
Case Else
MUSIC.Add("未知")
Return str.ToString
End Select
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str.ToString
End Function
''' <summary>
''' 指定播放器
''' </summary>
''' <param name="data_count"></param>
''' <param name="str"></param>
''' <returns></returns>
Public Function Set_cycle_mode_Specify_player(data_count As Byte(), str As StringBuilder) As StringBuilder
Try
Dim specifyplayer As Byte = data_count(8)
Select Case specifyplayer
Case &H1
str.Append("房间音乐:")
Case &H2
str.Append("洗手间音乐:")
Case &H3
str.Append("房间和洗手间:")
Case &H4
str.Append("门铃:")
End Select
str = Specify_cycle_mode(data_count, str)
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str
End Function
''' <summary>
''' 指定循环模式
''' </summary>
''' <param name="data_count"></param>
''' <param name="str"></param>
''' <returns></returns>
Public Function Specify_cycle_mode(data_count As Byte(), str As StringBuilder) As StringBuilder
Try
Dim Specifycyclemode As Byte = data_count(9)
Select Case Specifycyclemode
Case &H0
str.Append("全部循环;")
Case &H1
str.Append("单曲循环;")
Case &H2
str.Append("文件夹循环;")
Case &H3
str.Append("随机播放;")
Case &H5
str.Append("顺序播放;")
End Select
Catch ex As Exception
AdminLog.ApplicationLog.WriteErrorLog(ex)
End Try
Return str
End Function
#End Region
#End Region
Private Sub C5_MUSIC_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class