ソースを参照

版本升级维护

yyqxiaoyin 5 年 前
コミット
50f72b0426

+ 6 - 0
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.h

@@ -188,5 +188,11 @@
 /// @param channelFlag 频道标识
 - (void)updateChannel:(NSString *)channelFlag device:(id<MKRUPnPDevice>)device;
 
+/// 设置播放模式
+/// @param playMode 播放模式
+/// @param device 需要设置播放模式的设备
+/// @param channelNO 设置播放模式的频道
+- (void)setPlayMode:(MKRRadioPlayMode)playMode device:(id<MKRUPnPDevice>)device channelNO:(NSInteger)channelNO;
+
 @end
 

+ 26 - 0
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.m

@@ -554,6 +554,32 @@ static inline void wd_playControl_queue(void (^block)(void)){
     });
 }
 
+- (void)setPlayMode:(MKRRadioPlayMode)playMode device:(id<MKRUPnPDevice>)device channelNO:(NSInteger)channelNO{
+    NSString *playModeString = @"";
+    switch (playMode) {
+        case MKRRadioPlayModeOrder:{
+             playModeString = @"REPEAT_ALL";
+        }
+            break;
+        case MKRRadioPlayModeSingle:{
+             playModeString = @"REPEAT_ONE";
+        }
+            break;
+        case MKRRadioPlayModeRandom:{
+             playModeString = @"SHUFFLE";
+        }
+            break;
+        default:{
+             playModeString = @"REPEAT_ALL";
+        }
+            break;
+    }
+    NSString *string = [NSString stringWithFormat:@"CHANNEL_UPDATE_%zd",channelNO];
+    wd_playControl_queue(^{
+        libupnp_SetPlayModeV2(device.groupManagementUrl, playModeString, string, self.userID);
+    });
+}
+
 - (id <MKRRadioResorce>)getPlayingStatusWithDevice:(id <MKRUPnPDevice>)device {
     wd_playControl_queue(^{
         NSDictionary *resultDic = [[ASControlTools sharedInstanceUPNP] libupnp_getPlayInfo:device.avTransportUrl];

+ 2 - 0
libs/libAS-Control.framework/Headers/ASControlTools.h

@@ -351,4 +351,6 @@ int libupnp_SetAVTransportURIV2(NSString *controlurl,
                               NSString *songFrom,//来源类别
                               NSString *songAlbumID);//专辑ID
 
+int libupnp_SetPlayModeV2(NSString *ControlURL, NSString *CurrentPlayMode,NSString *channelFlag,NSString *userID);  //设置CurrentPlayMode: NORMAL/REPEAT_ALL/REPEAT_ONE/SHUFFLE
+
 @end

BIN
libs/libAS-Control.framework/libAS-Control