janbar / noson Goto Github PK
View Code? Open in Web Editor NEWC++ library for accessing SONOS devices.
License: GNU General Public License v3.0
C++ library for accessing SONOS devices.
License: GNU General Public License v3.0
I get this:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
THis occurs when I make a discover and I call l bool System::ConnectZone(const ZonePtr& zone, void* CBHandle, EventCB eventCB) I see that a new Player(zone, m_eventHandler, CBHandle, eventCB) is connected.
What shall I do to prevent it ?
Would it be a good idea in System::ConnectZone to destry an eventual player stored at m_connectedZone.player ?
Hi, so far, love the concept. but I'm having some issues figuring out how to use this library. My goal is a QT C++ implementation to add into a QT frontend I have in my living room that shows a clock, TV metadata, and some other information from around the house. I would love to use noson to add to that the ability to show what's on my speakers when they are playing.
I'm using the noson test.cpp as a jumping off point, and am digging into the source (doxygen and source actually). However, I'm having some trouble identifying how to use the API effectively. I have been able to follow the test.cpp code to list my players and zones in a test UI, but what I'm having trouble with is identifying HOW to use a player object to get status of when something starts to play, get the player metadata and album art, and what is the callback used for and how? More importantly, how does one use the handle to determine context? I can see that a callback is fired in Player::CB_RenderingControl, but I don't know why, or how to determine from the handle that this is what happened.
So, what I'm asking for is a small documented API getting started guide. The doxygen doesn't actually tell me how Discover() works, or how GetPlayer works, or how to use those things to cobble together a useful implementation. Google isn't showing me any existing apps that used the library directly, so I can't find someone else who has figured this out already.
Also, as I dig into the code, would you be willing to accept documentation updates as patches if I can (or have time) to do them? Doxygen can be very powerful if you have a main page with some examples and then each function tells why it's used and other details.
Is there an asynchronous API for noson library?
Hi,
Just tried to test this app out and received "No Sonos zone found".
It's a fresh install of 16.04, no VPN or anything, just connected directly to the network the Sonos Play is on.
Are there any logs I can access?
Hi Janbar,
first at all thanks for your work!
I'm trying to handle my sonos via the knx installation of my home.
So far looks like working, my major problem is to handle when the groups/zones are changing.
I tried to supervise the connectedZonePtr->GetZoneName but this is not changing after initialization.
When I got a CB event from the System, I also tried to get again the GetZoneList() and scan, but no one is set as disconnected (for the moment I decided to keep all devices not p grouped in a zone when I start my application).
I have to admit that I know good ansi C (development of embedded systems since 20 years) but the C++ special features are not my specialty, this maybe limits a bit my understanding of your library.
There are my questions:
Thanks a lot
Daniele
Bug or feature?
After installing, the library, I'm currently using gcc -lnosonos mystuff.cpp
in the makefile. However whatever I'm trying to compile, I'm getting linker errors. For instance, here's a minimal example:
#include <noson/sonossystem.h>
#include <noson/sonosplayer.h>
#include <noson/contentdirectory.h>
#include <noson/didlparser.h>
#include <noson/imageservice.h>
#include <noson/filestreamer.h>
#ifdef HAVE_PULSEAUDIO
#include <noson/pulsestreamer.h>
#endif
SONOS::System *gSonos = 0;
SONOS::PlayerPtr gPlayer;
int gDebug = 0;
The error message for this example is:
g++ -o binary -lnoson main.cpp
/usr/bin/ld: /tmp/ccv53Urr.o: in function `SONOS::shared_ptr<SONOS::Player>::reset()':
main.cpp:(.text._ZN5SONOS10shared_ptrINS_6PlayerEE5resetEv[_ZN5SONOS10shared_ptrINS_6PlayerEE5resetEv]+0x26): undefined reference to `SONOS::IntrinsicCounter::Decrement()'
/usr/bin/ld: main.cpp:(.text._ZN5SONOS10shared_ptrINS_6PlayerEE5resetEv[_ZN5SONOS10shared_ptrINS_6PlayerEE5resetEv]+0x6d): undefined reference to `SONOS::IntrinsicCounter::~IntrinsicCounter()'
collect2: error: ld returned 1 exit status
What do I need to feed to my linker in order to be able to write noson code?
https://man.openbsd.org/swap16.3
/usr/ports/pobj/noson-2.12.6/noson-2.12.6/noson/src/private/byteorder.h:57:23: error: redefinition of '__uint16_t' as different kind of symbol
static inline int16_t swap16(int16_t val)
^
I haven't looked as to why noson needs its own routines for this and/or which one should be used, but a simple fix to unbreak the build is prepending #undef swap16
to the function definition in byteorder.h -- same problem for swap32().
Full build failure log, in case that helps: https://gist.github.com/klemensn/cc23726ee6231c0708720905003168c2
hey janbar
I tried to run ./nosontest but sonos.Discover() returns false.
I have a Sonos Play:1 in the same LAN as my dev environment.
Am I'missing something?
greetz
This looks like what I'm looking for. I have built the lib and run tests on Ubuntu - all seems to be working. Would like to see some documents on how to use the library possibly with a few examples. My goal is to build a server side tool to schedule/shape sound scenes across a Sonos network spanning a large residential building (17 locations at present).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.