diff options
| author | BrettyWhite <geekman3454@protonmail.com> | 2017-07-27 14:49:34 -0400 |
|---|---|---|
| committer | BrettyWhite <geekman3454@protonmail.com> | 2017-07-27 14:49:34 -0400 |
| commit | 6f625f2b252e0e70efc22791fe60e0da71b5a012 (patch) | |
| tree | e6658607ac201e1cd8747e7fa00934bfb396ce8b /SmartDeviceLink | |
| parent | 9ff88809872b23c7f2241af4bca41e7e45717494 (diff) | |
| download | sdl_ios-6f625f2b252e0e70efc22791fe60e0da71b5a012.tar.gz | |
added final two structs
Diffstat (limited to 'SmartDeviceLink')
| -rw-r--r-- | SmartDeviceLink/SDLNames.h | 5 | ||||
| -rw-r--r-- | SmartDeviceLink/SDLSystemCapability.m | 1 | ||||
| -rw-r--r-- | SmartDeviceLink/SDLVideoStreamingCapability.h | 44 | ||||
| -rw-r--r-- | SmartDeviceLink/SDLVideoStreamingCapability.m | 75 | ||||
| -rw-r--r-- | SmartDeviceLink/SDLVideoStreamingFormat.h | 37 | ||||
| -rw-r--r-- | SmartDeviceLink/SDLVideoStreamingFormat.m | 50 | ||||
| -rw-r--r-- | SmartDeviceLink/SDLVideoStreamingProtocol.h | 58 | ||||
| -rw-r--r-- | SmartDeviceLink/SDLVideoStreamingProtocol.m | 78 |
8 files changed, 348 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLNames.h b/SmartDeviceLink/SDLNames.h index e6892800a..324dab99d 100644 --- a/SmartDeviceLink/SDLNames.h +++ b/SmartDeviceLink/SDLNames.h @@ -197,6 +197,7 @@ #define NAMES_make @"make" #define NAMES_maneuverComplete @"maneuverComplete" #define NAMES_manualTextEntry @"manualTextEntry" +#define NAMES_maxBitrate @"maxBitrate" #define NAMES_maxDuration @"maxDuration" #define NAMES_maximumChangeVelocity @"maximumChangeVelocity" #define NAMES_maxNumberRFCOMMPorts @"maxNumberRFCOMMPorts" @@ -291,6 +292,7 @@ #define NAMES_powerModeActive @"powerModeActive" #define NAMES_powerModeQualificationStatus @"powerModeQualificationStatus" #define NAMES_powerModeStatus @"powerModeStatus" +#define NAMES_preferredResolution @"preferredResolution" #define NAMES_prerecordedSpeech @"prerecordedSpeech" #define NAMES_presetBankCapabilities @"presetBankCapabilities" #define NAMES_pressAvailable @"pressAvailable" @@ -375,6 +377,7 @@ #define NAMES_subThoroughfare @"subThoroughfare" #define NAMES_success @"success" #define NAMES_supportedDiagModes @"supportedDiagModes" +#define NAMES_supportedFormats @"supportedFormats" #define NAMES_syncFileName @"syncFileName" #define NAMES_syncMsgVersion @"syncMsgVersion" #define NAMES_SyncPData @"SyncPData" @@ -432,6 +435,8 @@ #define NAMES_value @"value" #define NAMES_vdop @"vdop" #define NAMES_vehicleType @"vehicleType" +#define NAMES_videoCodec @"videoCodec" +#define NAMES_videoProtocol @"videoProtocol" #define NAMES_videoStreaming @"videoStreaming" #define NAMES_vin @"vin" #define NAMES_voiceRecOn @"voiceRecOn" diff --git a/SmartDeviceLink/SDLSystemCapability.m b/SmartDeviceLink/SDLSystemCapability.m index 495e59add..6901abf42 100644 --- a/SmartDeviceLink/SDLSystemCapability.m +++ b/SmartDeviceLink/SDLSystemCapability.m @@ -12,6 +12,7 @@ #import "SDLNavigationCapability.h" #import "SDLPhoneCapability.h" #import "SDLSystemCapabilityType.h" +#import "SDLVideoStreamingCapability.h" @implementation SDLSystemCapability diff --git a/SmartDeviceLink/SDLVideoStreamingCapability.h b/SmartDeviceLink/SDLVideoStreamingCapability.h new file mode 100644 index 000000000..b8d6692ec --- /dev/null +++ b/SmartDeviceLink/SDLVideoStreamingCapability.h @@ -0,0 +1,44 @@ +// +// SDLVideoStreamingCapability.h +// SmartDeviceLink-iOS +// +// Created by Brett McIsaac on 7/27/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLRPCMessage.h" + +@class SDLImageResolution; +@class SDLVideoStreamingFormat; + +@interface SDLVideoStreamingCapability : SDLRPCStruct + +/** + * @abstract Constructs a newly allocated SDLVideoStreamingCapability object + */ +- (instancetype)init; + +/** + * @abstract Constructs a newly allocated SDLVideoStreamingCapability object indicated by the dictionary parameter + * @param dict The dictionary to use + */ +- (instancetype)initWithDictionary:(NSMutableDictionary *)dict; + +/** + * @abstract The preferred resolution of a video stream for decoding and rendering on HMI, optional + */ +@property (strong, nonatomic) SDLImageResolution *preferredResolution; + +/** + * @abstract The maximum bitrate of video stream that is supported, in kbps, optional + * minvalue= 0 + * maxvalue= 2147483647 + */ +@property (strong, nonatomic) NSNumber *maxBitrate; + +/** + * @abstract Detailed information on each format supported by this system, in its preferred order, optional + */ +@property (strong, nonatomic) NSMutableArray *supportedFormats; + +@end diff --git a/SmartDeviceLink/SDLVideoStreamingCapability.m b/SmartDeviceLink/SDLVideoStreamingCapability.m new file mode 100644 index 000000000..9ddc4cf32 --- /dev/null +++ b/SmartDeviceLink/SDLVideoStreamingCapability.m @@ -0,0 +1,75 @@ +// +// SDLVideoStreamingCapability.m +// SmartDeviceLink-iOS +// +// Created by Brett McIsaac on 7/27/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLNames.h" +#import "SDLVideoStreamingFormat.h" +#import "SDLVideoStreamingCapability.h" + +@implementation SDLVideoStreamingCapability + +- (instancetype)init { + if (self = [super init]) { + } + return self; +} + +- (instancetype)initWithDictionary:(NSMutableDictionary *)dict { + if (self = [super initWithDictionary:dict]) { + } + return self; +} + +- (void)setPreferredResolution:(SDLImageResolution *)preferredResolution { + if (preferredResolution != nil) { + [store setObject:preferredResolution forKey:NAMES_preferredResolution]; + } else { + [store removeObjectForKey:NAMES_preferredResolution]; + } +} + +- (SDLImageResolution *)preferredResolution { + return store[NAMES_preferredResolution]; +} + +- (void)setMaxBitrate:(NSNumber *)maxBitrate { + if (maxBitrate != nil) { + [store setObject:maxBitrate forKey:NAMES_maxBitrate]; + } else { + [store removeObjectForKey:NAMES_maxBitrate]; + } +} + +- (NSNumber *)maxBitrate { + return store[NAMES_maxBitrate]; +} + +- (void)setSupportedFormats:(NSMutableArray *)supportedFormats { + if (supportedFormats != nil) { + [store setObject:supportedFormats forKey:NAMES_supportedFormats]; + } else { + [store removeObjectForKey:NAMES_supportedFormats]; + } +} + +- (NSMutableArray *)supportedFormats { + NSMutableArray *array = [store objectForKey:NAMES_supportedFormats]; + if ([array isEqual:[NSNull null]]) { + return [NSMutableArray array]; + } else if (array.count < 1 || [array.firstObject isKindOfClass:SDLVideoStreamingFormat.class]) { + return array; + } else { + NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]]; + for (NSDictionary *dict in array) { + [newList addObject:[[SDLVideoStreamingFormat alloc] initWithDictionary:(NSMutableDictionary *)dict]]; + } + return newList; + } +} + + +@end diff --git a/SmartDeviceLink/SDLVideoStreamingFormat.h b/SmartDeviceLink/SDLVideoStreamingFormat.h new file mode 100644 index 000000000..3f1b5829f --- /dev/null +++ b/SmartDeviceLink/SDLVideoStreamingFormat.h @@ -0,0 +1,37 @@ +// +// SDLVideoStreamingFormat.h +// SmartDeviceLink-iOS +// +// Created by Brett McIsaac on 7/27/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLRPCMessage.h" + +@class SDLVideoStreamingCodec; +@class SDLVideoStreamingProtocol; + +@interface SDLVideoStreamingFormat : SDLRPCStruct + +/** + * @abstract Constructs a newly allocated SDLVideoStreamingFormat object + */ +- (instancetype)init; + +/** + * @abstract Constructs a newly allocated SDLVideoStreamingFormat object indicated by the dictionary parameter + * @param dict The dictionary to use + */ +- (instancetype)initWithDictionary:(NSMutableDictionary *)dict; + +/** + * @abstract Protocol type, see VideoStreamingProtocol, mandatory + */ +@property (strong, nonatomic) SDLVideoStreamingProtocol *protocol; + +/** + * @abstract Codec type, see VideoStreamingCodec, mandatory + */ +@property (strong, nonatomic) SDLVideoStreamingCodec *codec; + +@end diff --git a/SmartDeviceLink/SDLVideoStreamingFormat.m b/SmartDeviceLink/SDLVideoStreamingFormat.m new file mode 100644 index 000000000..4cc4a7341 --- /dev/null +++ b/SmartDeviceLink/SDLVideoStreamingFormat.m @@ -0,0 +1,50 @@ +// +// SDLVideoStreamingFormat.m +// SmartDeviceLink-iOS +// +// Created by Brett McIsaac on 7/27/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLNames.h" +#import "SDLVideoStreamingFormat.h" + +@implementation SDLVideoStreamingFormat + +- (instancetype)init { + if (self = [super init]) { + } + return self; +} + +- (instancetype)initWithDictionary:(NSMutableDictionary *)dict { + if (self = [super initWithDictionary:dict]) { + } + return self; +} + +- (void)setVideoStreamingProtocol:(SDLVideoStreamingProtocol *)protocol { + if (protocol != nil) { + [store setObject:protocol forKey:NAMES_videoProtocol]; + } else { + [store removeObjectForKey:NAMES_videoProtocol]; + } +} + +- (SDLVideoStreamingProtocol *)protocol { + return store[NAMES_videoProtocol]; +} + +- (void)setVideoStreamingCodec:(SDLVideoStreamingCodec *)codec { + if (codec != nil) { + [store setObject:codec forKey:NAMES_videoCodec]; + } else { + [store removeObjectForKey:NAMES_videoCodec]; + } +} + +- (SDLVideoStreamingCodec *)codec { + return store[NAMES_videoCodec]; +} + +@end diff --git a/SmartDeviceLink/SDLVideoStreamingProtocol.h b/SmartDeviceLink/SDLVideoStreamingProtocol.h new file mode 100644 index 000000000..d36f969ec --- /dev/null +++ b/SmartDeviceLink/SDLVideoStreamingProtocol.h @@ -0,0 +1,58 @@ +// +// SDLVideoStreamingProtocol.h +// SmartDeviceLink-iOS +// +// Created by Brett McIsaac on 7/27/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLEnum.h" + +/** + * Enum for each type of video streaming protocol + * + * @since SDL 4.7 + */ +@interface SDLVideoStreamingProtocol : SDLEnum + +/** + * Convert String to SDLVideoStreamingProtocol + * + * @param value String value to retrieve the object for + * + * @return SDLVideoStreamingProtocol + */ ++ (SDLVideoStreamingProtocol *)valueOf:(NSString *)value; + +/** + @abstract Store the enumeration of all possible SDLVideoStreamingProtocol + @return an array that store all possible SDLVideoStreamingProtocol + */ ++ (NSArray *)values; + +/** + @abstract SDLVideoStreamingProtocol : RAW + */ ++ (SDLVideoStreamingProtocol *)RAW; + +/** + @abstract SDLVideoStreamingProtocol : RTP + */ ++ (SDLVideoStreamingProtocol *)RTP; + +/** + @abstract SDLVideoStreamingProtocol : RTSP + */ ++ (SDLVideoStreamingProtocol *)RTSP; + +/** + @abstract SDLVideoStreamingProtocol : RTMP + */ ++ (SDLVideoStreamingProtocol *)RTMP; + +/** + @abstract SDLVideoStreamingProtocol : WEBM + */ ++ (SDLVideoStreamingProtocol *)WEBM; + +@end diff --git a/SmartDeviceLink/SDLVideoStreamingProtocol.m b/SmartDeviceLink/SDLVideoStreamingProtocol.m new file mode 100644 index 000000000..0509be0cc --- /dev/null +++ b/SmartDeviceLink/SDLVideoStreamingProtocol.m @@ -0,0 +1,78 @@ +// +// SDLVideoStreamingProtocol.m +// SmartDeviceLink-iOS +// +// Created by Brett McIsaac on 7/27/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLVideoStreamingProtocol.h" + +SDLVideoStreamingProtocol *SDLVideoStreamingProtocol_RAW = nil; +SDLVideoStreamingProtocol *SDLVideoStreamingProtocol_RTP = nil; +SDLVideoStreamingProtocol *SDLVideoStreamingProtocol_RTSP = nil; +SDLVideoStreamingProtocol *SDLVideoStreamingProtocol_RTMP = nil; +SDLVideoStreamingProtocol *SDLVideoStreamingProtocol_WEBM = nil; + +NSArray *SDLVideoStreamingProtocol_values = nil; + +@implementation SDLVideoStreamingProtocol + ++ (SDLVideoStreamingProtocol *)valueOf:(NSString *)value { + for (SDLVideoStreamingProtocol *item in SDLVideoStreamingProtocol.values) { + if ([item.value isEqualToString:value]) { + return item; + } + } + return nil; +} + ++ (NSArray *)values { + if (SDLVideoStreamingProtocol_values == nil) { + SDLVideoStreamingProtocol_values = @[ + SDLVideoStreamingProtocol.RAW, + SDLVideoStreamingProtocol.RTP, + SDLVideoStreamingProtocol.RTSP, + SDLVideoStreamingProtocol.RTMP, + SDLVideoStreamingProtocol.WEBM + ]; + } + return SDLVideoStreamingProtocol_values; +} + ++ (SDLVideoStreamingProtocol *)RAW { + if (SDLVideoStreamingProtocol_RAW == nil) { + SDLVideoStreamingProtocol_RAW = [[SDLVideoStreamingProtocol alloc] initWithValue:@"RAW"]; + } + return SDLVideoStreamingProtocol_RAW; +} + ++ (SDLVideoStreamingProtocol *)RTP { + if (SDLVideoStreamingProtocol_RTP == nil) { + SDLVideoStreamingProtocol_RTP = [[SDLVideoStreamingProtocol alloc] initWithValue:@"RTP"]; + } + return SDLVideoStreamingProtocol_RTP; +} + ++ (SDLVideoStreamingProtocol *)RTSP { + if (SDLVideoStreamingProtocol_RTSP == nil) { + SDLVideoStreamingProtocol_RTSP = [[SDLVideoStreamingProtocol alloc] initWithValue:@"RTSP"]; + } + return SDLVideoStreamingProtocol_RTSP; +} + ++ (SDLVideoStreamingProtocol *)RTMP { + if (SDLVideoStreamingProtocol_RTMP == nil) { + SDLVideoStreamingProtocol_RTMP = [[SDLVideoStreamingProtocol alloc] initWithValue:@"RTMP"]; + } + return SDLVideoStreamingProtocol_RTMP; +} + ++ (SDLVideoStreamingProtocol *)WEBM { + if (SDLVideoStreamingProtocol_WEBM == nil) { + SDLVideoStreamingProtocol_WEBM = [[SDLVideoStreamingProtocol alloc] initWithValue:@"WEBM"]; + } + return SDLVideoStreamingProtocol_WEBM; +} + +@end |
