Skip to content

Commit

Permalink
MQTT-Client-Framework 0.3.3
Browse files Browse the repository at this point in the history
>Release date: 2015-10-10

[NEW] including tvOS with Cocoapods 0.39
[FIX] test coverage for topics containing 0x0000

[NEW] comment out tvOS until Cocoapods supports it
[NEW] inbound throttling closes #54

[NEW] provide support for tvOS, OSX and iOS closes #50
[NEW] add messageDelivered delegate message in MQTTSessionManager closes #49
[FIX] clarification of changing subscriptions in MQTTSessionManager closes #47
  • Loading branch information
Christoph Krey committed Oct 12, 2015
1 parent 88b5b60 commit 466e469
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 4 additions & 5 deletions MQTTClient.podspec
Original file line number Diff line number Diff line change
@@ -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
24 changes: 17 additions & 7 deletions MQTTClient/MQTTClient/MQTTMessage.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}

Expand Down
31 changes: 28 additions & 3 deletions MQTTClient/MQTTClientTests/MQTTClientPublishTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,44 @@ - (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];
}
}

/*
* [MQTT-1.5.3-2]
* 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
Expand Down
9 changes: 9 additions & 0 deletions MQTTClient/MQTTClientTests/MQTTClientTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import <UIKit/UIKit.h>
#endif
#import "MQTTSession.h"
#import "MQTTSSLSecurityPolicy.h"

/** delegate gives your application access to received messages
*/
Expand Down
Binary file modified MQTTClient/dist/MQTTClient.framework/Versions/A/MQTTClient
Binary file not shown.

0 comments on commit 466e469

Please sign in to comment.