Skip to content

Commit 084fb59

Browse files
lightIdの省略時の対応。その他、エラー処理。
1 parent 623fcef commit 084fb59

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

dConnectDevicePlugin/dConnectDeviceIRKit/dConnectDeviceIRKit/Classes/profile/DPIRKitLightProfile.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ - (id) initWithDevicePlugin:(DPIRKitDevicePlugin *)plugin
7575
@"Parameter 'flashing' invalid."];
7676
return YES;
7777
}
78+
NSString *brightnessString = [request stringForKey:@"brightness"];
79+
if ((brightnessString && [brightnessString length] == 0) || (brightness && ([brightness doubleValue] < 0.0 || [brightness doubleValue] > 1.0))) {
80+
[response setErrorToInvalidRequestParameterWithMessage:
81+
@"Parameter 'brightness' must be a value between 0 and 1.0."];
82+
return YES;
83+
}
7884
if (![weakSelf checkFlash:response flashing:flashing]) {
7985
return YES;
8086
}
@@ -143,7 +149,7 @@ - (BOOL)sendLightIRRequestWithServiceId:(NSString *)serviceId
143149
[response setErrorToNotSupportProfile];
144150
return send;
145151
}
146-
if (!lightId || (lightId && ![lightId isEqualToString:@"1"])) {
152+
if ((lightId && ![lightId isEqualToString:@"1"])) {
147153
[response setErrorToInvalidRequestParameterWithMessage:@"Invalid lightId"];
148154
return send;
149155
}

0 commit comments

Comments
 (0)