Latest 0.1.1
Homepage https://github.com/n1mda/sonos-objc
License MIT
Platforms ios 7.0, osx 10.9, requires ARC
Dependencies AFNetworking, CocoaAsyncSocket
Authors

An 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), CocoaAsyncSocket (iOS and OS X) and XMLReader.h/m (iOS and OS X)

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like sonos-objc in your projects. See the Cocoapods Website for more information.

Podfile

pod "sonos-objc", "~> 0.1.2"

Usage

#import "SonosManager.h"
#import "SonosController.h"

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    [[SonosManager sharedInstance] addObserver:self forKeyPath:@"allDevices" options:NSKeyValueObservingOptionNew context:NULL];
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
    SonosController *controller = [[SonosManager sharedInstance] currentDevice];
    [controller trackInfo:^(NSString *artist, NSString *title, NSString *album, NSURL *albumArt, NSInteger time, NSInteger duration, NSInteger queueIndex, NSString *trackURI, NSString *protocol, NSError *error){

        NSLog(@"Artist: %@", artist);
        NSLog(@"Title: %@", title);
        NSLog(@"Album: %@", album);
        NSLog(@"Album Art: %@", albumArt);
        NSLog(@"Time: %d", time);
        NSLog(@"Duration: %d", duration);
        NSLog(@"Place in queue: %d", queueIndex);
        NSLog(@"Track URI: %@", trackURI);
        NSLog(@"Protocol: %@", protocol);

    }];
}

See SonosController.h for usage on how to control devices

Latest podspec

{
    "name": "sonos-objc",
    "version": "0.1.1",
    "description": "    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)n",
    "summary": "A simple Objective-C API for controlling Sonos Devices.",
    "homepage": "https://github.com/n1mda/sonos-objc",
    "license": "MIT",
    "authors": {
        "n1mda": "[email protected]"
    },
    "source": {
        "git": "https://github.com/n1mda/sonos-objc.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "7.0",
        "osx": "10.9"
    },
    "requires_arc": true,
    "source_files": "sonos-objc/**/*.{h,m}",
    "public_header_files": "sonos-objc/**/*.h",
    "dependencies": {
        "AFNetworking": [
            "2.0.3"
        ],
        "CocoaAsyncSocket": [
            "7.3.3"
        ]
    }
}

Pin It on Pinterest

Share This