diff --git a/CHANGELOG.md b/CHANGELOG.md index b763434f..bad932d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ MQTT-Client-Framework iOS Release Notes ======================================= +## MQTT-Client-Framework 0.3.3 +>Release date: 2015-10-10 + +[NEW] including tvOS with Cocoapods 0.39 +[FIX] test coverage for topics containing 0x0000 + ## MQTT-Client-Framework 0.3.1/2 >Release date: 2015-10-08 diff --git a/MQTTClient.podspec b/MQTTClient.podspec index 635e3a50..1d83dc27 100644 --- a/MQTTClient.podspec +++ b/MQTTClient.podspec @@ -1,19 +1,18 @@ Pod::Spec.new do |s| s.name = "MQTTClient" - s.version = "0.3.2" + s.version = "0.3.3" s.summary = "iOS, OSX and tvOS native ObjectiveC MQTT Framework" s.homepage = "https://github.com/ckrey/MQTT-Client-Framework" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Christoph Krey" => "krey.christoph@gmail.com" } - s.source = { :git => "https://github.com/ckrey/MQTT-Client-Framework.git", :tag => "0.3.2" } + s.source = { :git => "https://github.com/ckrey/MQTT-Client-Framework.git", :tag => "0.3.3" } s.source_files = "MQTTClient/MQTTClient", "MQTTClient/MQTTClient/**/*.{h,m}" s.requires_arc = true -# s.platform = :ios, "6.1", :osx, "10.10", :tvos, "9.0" - s.platform = :ios, "6.1", :osx, "10.10" + s.platform = :ios, "6.1", :osx, "10.10", :tvos, "9.0" s.ios.deployment_target = "6.1" s.osx.deployment_target = "10.10" -# s.tvos.deployment_target = "9.0" + s.tvos.deployment_target = "9.0" end diff --git a/MQTTClient/MQTTClient/MQTTMessage.m b/MQTTClient/MQTTClient/MQTTMessage.m index c321a175..1edbf1e1 100644 --- a/MQTTClient/MQTTClient/MQTTMessage.m +++ b/MQTTClient/MQTTClient/MQTTMessage.m @@ -262,16 +262,26 @@ - (void)appendUInt16BigEndian:(UInt16)val - (void)appendMQTTString:(NSString *)string { if (string) { +// UInt8 buf[2]; +// if (DEBUGMSG) NSLog(@"String=%@", string); +// const char* utf8String = [string UTF8String]; +// if (DEBUGMSG) NSLog(@"UTF8=%s", utf8String); +// +// size_t strLen = strlen(utf8String); +// buf[0] = strLen / 256; +// buf[1] = strLen % 256; +// [self appendBytes:buf length:2]; +// [self appendBytes:utf8String length:strLen]; + +// This updated code allows for all kind or UTF characters including 0x0000 + NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; UInt8 buf[2]; - if (DEBUGMSG) NSLog(@"String=%@", string); - const char* utf8String = [string UTF8String]; - if (DEBUGMSG) NSLog(@"UTF8=%s", utf8String); + UInt16 len = data.length; + buf[0] = len / 256; + buf[1] = len % 256; - size_t strLen = strlen(utf8String); - buf[0] = strLen / 256; - buf[1] = strLen % 256; [self appendBytes:buf length:2]; - [self appendBytes:utf8String length:strLen]; + [self appendData:data]; } } diff --git a/MQTTClient/MQTTClientTests/MQTTClientPublishTests.m b/MQTTClient/MQTTClientTests/MQTTClientPublishTests.m index 53196126..f6be7970 100644 --- a/MQTTClient/MQTTClientTests/MQTTClientPublishTests.m +++ b/MQTTClient/MQTTClientTests/MQTTClientPublishTests.m @@ -79,9 +79,22 @@ - (void)testPublish_r0_q0_0xFEFF_MQTT_1_5_3_3 * include encodings of code points between U+D800 and U+DFFF. If a Server or Client receives a Control * Packet containing ill-formed UTF-8 it MUST close the Network Connection. */ -- (void)testPublish_r0_q0_0x00_MQTT_1_5_3_1 +- (void)testPublish_r0_q0_0xD800_MQTT_1_5_3_1 { NSLog(@"can't test [MQTT-1.5.3-1]"); + NSString *stringWithD800 = [NSString stringWithFormat:@"%@/%C/%s", TOPIC, 0xD800, __FUNCTION__]; + NSLog(@"stringWithNull(%lu) %@", (unsigned long)stringWithD800.length, stringWithD800.description); + + for (NSString *broker in BROKERLIST) { + NSLog(@"testing broker %@", broker); + NSDictionary *parameters = BROKERS[broker]; + [self connect:parameters]; + [self testPublishCloseExpected:[@(__FUNCTION__) dataUsingEncoding:NSUTF8StringEncoding] + onTopic:stringWithD800 + retain:NO + atLevel:MQTTQosLevelAtMostOnce]; + [self shutdown:parameters]; + } } /* @@ -89,9 +102,21 @@ - (void)testPublish_r0_q0_0x00_MQTT_1_5_3_1 * A UTF-8 encoded string MUST NOT include an encoding of the null character U+0000. * If a receiver (Server or Client) receives a Control Packet containing U+0000 it MUST close the Network Connection. */ -- (void)testPublish_r0_q0_0xD800_MQTT_1_5_3_2 +- (void)testPublish_r0_q0_0x0000_MQTT_1_5_3_2 { - NSLog(@"can't test [MQTT-1.5.3-2]"); + NSString *stringWithNull = [NSString stringWithFormat:@"%@/%C/%s", TOPIC, 0, __FUNCTION__]; + NSLog(@"stringWithNull(%lu) %@", (unsigned long)stringWithNull.length, stringWithNull.description); + + for (NSString *broker in BROKERLIST) { + NSLog(@"testing broker %@", broker); + NSDictionary *parameters = BROKERS[broker]; + [self connect:parameters]; + [self testPublishCloseExpected:[@(__FUNCTION__) dataUsingEncoding:NSUTF8StringEncoding] + onTopic:stringWithNull + retain:NO + atLevel:MQTTQosLevelAtMostOnce]; + [self shutdown:parameters]; + } } - (void)testPublish_r0_q1 diff --git a/MQTTClient/MQTTClientTests/MQTTClientTests.m b/MQTTClient/MQTTClientTests/MQTTClientTests.m index 0a2feb68..114dd41c 100644 --- a/MQTTClient/MQTTClientTests/MQTTClientTests.m +++ b/MQTTClient/MQTTClientTests/MQTTClientTests.m @@ -545,6 +545,15 @@ - (void)test_connect_illegal_protocollevel0_and_protocolname_MQTT_3_1_2_1 { } } +/* + * [MQTT-3.1.0-1] + * After a Network Connection is established by a Client to a Server, the first Packet sent from the + * Client to the Server MUST be a CONNECT Packet. + */ +- (void)test_first_packet_MQTT_3_1_0_1 { + NSLog(@"can't test [MQTT-3.1.0-1]"); +} + - (void)test_ping { for (NSString *broker in BROKERLIST) { NSLog(@"testing broker %@", broker); diff --git a/MQTTClient/dist/MQTTClient.framework/Versions/A/Headers/MQTTSessionManager.h b/MQTTClient/dist/MQTTClient.framework/Versions/A/Headers/MQTTSessionManager.h index 3b2fab95..e5e328b8 100644 --- a/MQTTClient/dist/MQTTClient.framework/Versions/A/Headers/MQTTSessionManager.h +++ b/MQTTClient/dist/MQTTClient.framework/Versions/A/Headers/MQTTSessionManager.h @@ -11,6 +11,7 @@ #import #endif #import "MQTTSession.h" +#import "MQTTSSLSecurityPolicy.h" /** delegate gives your application access to received messages */ diff --git a/MQTTClient/dist/MQTTClient.framework/Versions/A/MQTTClient b/MQTTClient/dist/MQTTClient.framework/Versions/A/MQTTClient index e582d04b..47a851e1 100644 Binary files a/MQTTClient/dist/MQTTClient.framework/Versions/A/MQTTClient and b/MQTTClient/dist/MQTTClient.framework/Versions/A/MQTTClient differ