Skip to content

Commit

Permalink
Merge pull request #126 from SUPLA/develop
Browse files Browse the repository at this point in the history
v2.3.22
  • Loading branch information
przemyslawzygmunt authored Oct 8, 2020
2 parents 7d917e6 + f9e851c commit 86ad686
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 11 deletions.
8 changes: 4 additions & 4 deletions SUPLA.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2762,7 +2762,7 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 62;
CURRENT_PROJECT_VERSION = 63;
DEFINES_MODULE = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
Expand All @@ -2777,7 +2777,7 @@
"$(inherited)",
"$(PROJECT_DIR)/SUPLA/lib",
);
MARKETING_VERSION = 2.3.21;
MARKETING_VERSION = 2.3.22;
PRODUCT_BUNDLE_IDENTIFIER = com.acsoftware.ios.supla;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SUPLA/SUPLA-Bridging-Header.h";
Expand All @@ -2794,7 +2794,7 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 62;
CURRENT_PROJECT_VERSION = 63;
DEFINES_MODULE = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
Expand All @@ -2809,7 +2809,7 @@
"$(inherited)",
"$(PROJECT_DIR)/SUPLA/lib",
);
MARKETING_VERSION = 2.3.21;
MARKETING_VERSION = 2.3.22;
PRODUCT_BUNDLE_IDENTIFIER = com.acsoftware.ios.supla;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "SUPLA/SUPLA-Bridging-Header.h";
Expand Down
2 changes: 2 additions & 0 deletions SUPLA/ChannelCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ -(void)setChannelBase:(SAChannelBase *)channelBase {
case SUPLA_CHANNELFNC_CONTROLLINGTHEDOORLOCK:
case SUPLA_CHANNELFNC_CONTROLLINGTHEGATEWAYLOCK:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW:
case SUPLA_CHANNELFNC_ELECTRICITY_METER:
case SUPLA_CHANNELFNC_IC_ELECTRICITY_METER:
case SUPLA_CHANNELFNC_IC_GAS_METER:
Expand Down Expand Up @@ -191,6 +192,7 @@ -(void)setChannelBase:(SAChannelBase *)channelBase {
case SUPLA_CHANNELFNC_OPENINGSENSOR_GATE:
case SUPLA_CHANNELFNC_OPENINGSENSOR_GATEWAY:
case SUPLA_CHANNELFNC_OPENINGSENSOR_ROLLERSHUTTER:
case SUPLA_CHANNELFNC_OPENINGSENSOR_ROOFWINDOW:
case SUPLA_CHANNELFNC_OPENINGSENSOR_WINDOW:
case SUPLA_CHANNELFNC_MAILSENSOR:
self.left_OnlineStatus.hidden = NO;
Expand Down
4 changes: 4 additions & 0 deletions SUPLA/MainVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ - (void)onEvent:(NSNotification *)notification {
case SUPLA_EVENT_CONTROLLINGTHEROLLERSHUTTER:
msg = NSLocalizedString(@"opened / closed roller shutter", nil);
break;
case SUPLA_EVENT_CONTROLLINGTHEROOFWINDOW:
msg = NSLocalizedString(@"opened / closed the roof window", nil);
break;
case SUPLA_EVENT_POWERONOFF:
msg = NSLocalizedString(@"turned the power ON/OFF", nil);
break;
Expand Down Expand Up @@ -529,6 +532,7 @@ - (SADetailView*)getDetailViewForCell:(SAChannelCell*)_cell {
break;

case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW:

if ( _rsDetailView == nil ) {

Expand Down
2 changes: 1 addition & 1 deletion SUPLA/RSDetailView.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ -(void)dataToView {
self.onlineStatus.percent = cgroup.onlinePercent;
self.rsView.percent = 0;

NSMutableArray *positions = cgroup.rsPositions;
NSMutableArray *positions = cgroup.positions;
for(int a=0;a<positions.count;a++) {
int p = [[positions objectAtIndex:a] intValue];
if (p < 0) {
Expand Down
3 changes: 2 additions & 1 deletion SUPLA/SAChannel+CoreDataClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ - (bool) flooding{
- (int) imgIsActive {

if ( [self isOnline]
&& self.func == SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER
&& (self.func == SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER
|| self.func == SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW)
&& self.percentValue >= 100) {
return 1;
}
Expand Down
10 changes: 10 additions & 0 deletions SUPLA/SAChannelBase+CoreDataClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,12 @@ - (NSString *)getChannelCaption {
return NSLocalizedString(@"Door", nil);
case SUPLA_CHANNELFNC_OPENINGSENSOR_ROLLERSHUTTER:
return NSLocalizedString(@"Roller shutter opening sensor", nil);
case SUPLA_CHANNELFNC_OPENINGSENSOR_ROOFWINDOW:
return NSLocalizedString(@"Roof window opening sensor", nil);
case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER:
return NSLocalizedString(@"Roller shutter", nil);
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW:
return NSLocalizedString(@"Roof window", nil);
case SUPLA_CHANNELFNC_POWERSWITCH:
return NSLocalizedString(@"Power switch", nil);
case SUPLA_CHANNELFNC_LIGHTSWITCH:
Expand Down Expand Up @@ -285,13 +289,15 @@ - (int) imgIsActive {
case SUPLA_CHANNELFNC_CONTROLLINGTHEGARAGEDOOR:
case SUPLA_CHANNELFNC_CONTROLLINGTHEDOORLOCK:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW:
return [self hiSubValue];

case SUPLA_CHANNELFNC_OPENINGSENSOR_GATEWAY:
case SUPLA_CHANNELFNC_OPENINGSENSOR_GATE:
case SUPLA_CHANNELFNC_OPENINGSENSOR_GARAGEDOOR:
case SUPLA_CHANNELFNC_OPENINGSENSOR_DOOR:
case SUPLA_CHANNELFNC_OPENINGSENSOR_ROLLERSHUTTER:
case SUPLA_CHANNELFNC_OPENINGSENSOR_ROOFWINDOW:
case SUPLA_CHANNELFNC_MAILSENSOR:
case SUPLA_CHANNELFNC_OPENINGSENSOR_WINDOW:
case SUPLA_CHANNELFNC_POWERSWITCH:
Expand Down Expand Up @@ -423,6 +429,10 @@ - (UIImage*) getIconWithIndex:(short)idx {
case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER:
n1 = @"rollershutter";
break;
case SUPLA_CHANNELFNC_OPENINGSENSOR_ROOFWINDOW:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW:
n1 = @"roofwindow";
break;
case SUPLA_CHANNELFNC_POWERSWITCH:
switch(self.alticon) {
case 1:
Expand Down
2 changes: 1 addition & 1 deletion SUPLA/SAChannelGroup+CoreDataClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL) diffWithBuffer;
- (void) assignBuffer;
- (int) activePercent;
- (NSMutableArray*) rsPositions;
- (NSMutableArray*) positions;
- (NSMutableArray*) colors;
- (NSMutableArray*) colorBrightness;
- (NSMutableArray*) brightness;
Expand Down
10 changes: 7 additions & 3 deletions SUPLA/SAChannelGroup+CoreDataClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ - (void) addValueToBuffer:(SAChannelValue*)value {
case SUPLA_CHANNELFNC_CONTROLLINGTHEGATE:
case SUPLA_CHANNELFNC_CONTROLLINGTHEGARAGEDOOR:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW:
case SUPLA_CHANNELFNC_POWERSWITCH:
case SUPLA_CHANNELFNC_LIGHTSWITCH:
case SUPLA_CHANNELFNC_DIMMER:
Expand Down Expand Up @@ -88,7 +89,8 @@ - (void) addValueToBuffer:(SAChannelValue*)value {
case SUPLA_CHANNELFNC_VALVE_PERCENTAGE:
[BufferTotalValue addObject:[NSNumber numberWithInt: value.percentValue]];
break;
case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER: {
case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW: {
NSArray *obj = [NSArray arrayWithObjects:[NSNumber numberWithInt: value.percentValue],
[NSNumber numberWithBool: value.hiSubValue & 0x1], nil];
[BufferTotalValue addObject:obj];
Expand Down Expand Up @@ -213,6 +215,7 @@ - (int) activePercentForIndex:(int)idx {
}
break;
case SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER:
case SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW:
if ([self getIntFromObject:[v objectAtIndex:a] atArrIndex:0] >= 100 // percent
|| [self getIntFromObject:[v objectAtIndex:a] atArrIndex:1] > 0) { // sensor
sum++;
Expand Down Expand Up @@ -252,10 +255,11 @@ - (int) imgIsActive {
return self.activePercent >= 100;
}

- (NSMutableArray*) rsPositions {
- (NSMutableArray*) positions {
NSMutableArray *result = [[NSMutableArray alloc] init];

if (self.func == SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER
if ((self.func == SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER
|| self.func == SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW)
&& self.total_value != nil) {
NSArray *ar = (NSArray*)self.total_value;
for(int a=0;a<ar.count;a++) {
Expand Down
2 changes: 1 addition & 1 deletion SUPLA/SADownloadMeasurements.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ - (void)task {
if ( (item = [items objectAtIndex:a])
&& [item isKindOfClass:[NSDictionary class]]
&& (str_ts = [item valueForKey:@"date_timestamp"])
&& min == [str_ts longLongValue]) {
&& llabs(min-[str_ts longLongValue]) < 1800) {

found = YES;
break;
Expand Down
4 changes: 4 additions & 0 deletions SUPLA/lib/include/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ extern char sproto_tag[SUPLA_TAG_SIZE];
#define SUPLA_CHANNELFNC_CONTROLLINGTHEDOORLOCK 90
#define SUPLA_CHANNELFNC_OPENINGSENSOR_DOOR 100
#define SUPLA_CHANNELFNC_CONTROLLINGTHEROLLERSHUTTER 110
#define SUPLA_CHANNELFNC_CONTROLLINGTHEROOFWINDOW 115
#define SUPLA_CHANNELFNC_OPENINGSENSOR_ROLLERSHUTTER 120
#define SUPLA_CHANNELFNC_OPENINGSENSOR_ROOFWINDOW 125
#define SUPLA_CHANNELFNC_POWERSWITCH 130
#define SUPLA_CHANNELFNC_LIGHTSWITCH 140
#define SUPLA_CHANNELFNC_RING 150
Expand Down Expand Up @@ -378,12 +380,14 @@ extern char sproto_tag[SUPLA_TAG_SIZE];
#define SUPLA_BIT_FUNC_PRESSURESENSOR 0x00001000 // ver. >= 12
#define SUPLA_BIT_FUNC_RAINSENSOR 0x00002000 // ver. >= 12
#define SUPLA_BIT_FUNC_WEIGHTSENSOR 0x00004000 // ver. >= 12
#define SUPLA_BIT_FUNC_CONTROLLINGTHEROOFWINDOW 0x00008000

#define SUPLA_EVENT_CONTROLLINGTHEGATEWAYLOCK 10
#define SUPLA_EVENT_CONTROLLINGTHEGATE 20
#define SUPLA_EVENT_CONTROLLINGTHEGARAGEDOOR 30
#define SUPLA_EVENT_CONTROLLINGTHEDOORLOCK 40
#define SUPLA_EVENT_CONTROLLINGTHEROLLERSHUTTER 50
#define SUPLA_EVENT_CONTROLLINGTHEROOFWINDOW 55
#define SUPLA_EVENT_POWERONOFF 60
#define SUPLA_EVENT_LIGHTONOFF 70
#define SUPLA_EVENT_STAIRCASETIMERONOFF 80 // ver. >= 9
Expand Down

0 comments on commit 86ad686

Please sign in to comment.