sonos-objc 0.1.1

sonos-objc 0.1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



 
Depends on:
AFNetworking= 2.0.3
CocoaAsyncSocket= 7.3.3
 

  • By
  • n1mda

A simple Objective-C API for controlling Sonos Devices

The aim of this library is to create a simple to use, yet useful API to control Sonos Devices via SOAP. It depends on AFNetworking (iOS and OS X) and XMLReader.h/m (iOS and OS X)

Usage

#import "SonosDiscover.h"
#import "SonosController.h"

@interface ViewController ()
@property (nonatomic, strong) NSMutableArray *sonosDevices;
@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.devices = [[NSMutableArray alloc] init];
    [SonosDiscover discoverControllers:^(NSArray *devices, NSError *error){
    NSLog(@"Devices: %@", devices);
        for (NSDictionary *device in devices) {
            SonosController *controller = [[SonosController alloc] initWithIP:device[@"ip"] port:[device[@"port"] intValue]];
            [self.sonosDevices addObject:controller];
        }
    }];
}

See SonosController.h for usage on how to control devices