Nnanomsg bus routing support? - nanomsg

I have been using NNG (C++) - now I need to write a C# plugin to read the NNG NanoMSG messages. But I am moving from pub/sub to a bus/mesh protocol. e.g.
https://nanomsg.org/gettingstarted/bus.html
Does nnanomsg support that?
What switches on the socket (options do I need) e.g. NN_BUS? NN_SOL_SOCKET?

The last PR merged included a Bus example. That said, I haven't used the Bus protocol.
If you're using nng, there's also a C# wrapper for that called csnng. I believe it doesn't include the nanomsg "compat" API, but it includes the nng bus protocol.
Not that it's a substantial amount of work, but I forked both NNanomsg and csnng to make .Net Standard libraries.

Don't know why the question should be marked negative. Although no one answered, I went implemented it with: https://github.com/mhowlett/NNanomsg
and the answers to the questions are:
Yes NNanomsg works fine with C++ NNG
Yes it has no problem with BUS protocols, and there are examples in the github.

Related

Endianess (Big Endian/Little Endian) support in plc4x library

I want to check if there is support for endianness(little endian/big endian) in plc4x modbus library to process the response based on that . I could not find any documentation or example on how to use if it exists.
So, request to same some links here if available.
Right now we currently don't support this, but we are aware of an option to fix this. Till now we haven't implemented any support for this mainly because none of our core contributors has access to such a Modbus device. If you have one particular device in mind, could you please name the Type an model or if you could provide us with such a device ... perhaps we can come up with an implementation.

SPICE protocol extension

I am doing a project that extends SPICE. I need to send some custom data between server and client. I beleiev this is done by adding a custom channel to the SPICE protocol
I've got the source code, but it's huge and overwhelming. Can anyone give me a few pointers as to how to start, or direct me to a similar project so I can refer?
Thanks in advance
I suggest to start reading the "SPICE for Newbies" document, then moving to other documentation. It will give you some introduction on the architecture of SPICE, the protocol, standard channels, etc.
Available on spice-space.org/documentation.html
Since spice-gtk 0.15, and qemu 1.4.0, you can set up arbitrary channels by name using the "Spice port", see spicy.c code for an example of usage.

Making my own application for my USB MIDI device

I want to try and make my own application for my Novation Nocturn, which is a USB DJ controller surface. The application software interacts with it to send out MIDI messages to software like Traktor, Ableton and Cubase.
I'm aware of libusb, but that's as far as I've got. I've successfully installed it to interact with my device but stopped there.
I'm after some suitable reading material basically. USB specs, MIDI specs and such. If I'm honest the full USB 2.0 spec looks like it holds loads of stuff I don't need.
Just looking for something interesting to do now that I've finished my degree (Computer Science). My current programming knowledge is C++ and mainly C#.
Could do with some direction on how to get stuck into this task.
edit:
Update to include some info from the Device Manager on the Nocturn.
Hardware IDs:
USB\VID_1235&PID_000A&REV_0009
USB\VID_1235&PID_000A
Compatible IDs:
USB\Class_FF&SubClass_00&Prot_00
USB\Class_FF&SubClass_00
USB\Class_FF
Device Class:
MEDIA
USB MIDI is probably one abstraction layer lower than you want to deal with. I'd suggest finding a good MIDI framework and interacting with the device via MIDI instead.
For C++, Juce is probably the way to go, as you didn't mention a target platform or any other specific requirements.
If you want to go the .NET route, the easiest way to get started is with the C# MIDI Toolkit code:
http://www.codeproject.com/KB/audio-video/MIDIToolkit.aspx
In there, you'll find all the basics for opening an device, reading input, and writing output. Alternatively, NAudio has some MIDI classes, but they are somewhat incomplete.
As you develop, you'll want a reference for the MIDI spec handy.
A tool that you will find invaluable is MIDI-OX. In fact, I suggest that before you start coding, you fire up MIDI-OX and use it to sniff the messages coming from the Novation. It will give you a good idea of what the Novation sends. You can use it in conjunction with MIDI Yoke (a configurable virtual MIDI port) to insert itself between the Novation, and Ableton Live (or whatever software you normally use with your Novation) so you can see all of the messages in normal use.
Done... Kidding, but I've started on this in Python - I personally want linux support. I am teaching myself python, but I only dabble in programming.
You can see basic functionality at https://github.com/dewert/nocturn-linux-midi. The guy who reverse engineered it (i.e. the leap I wouldn't have been able to make myself) doesn't seem to be doing any more with it. His code is at https://github.com/timoahummel/nocturn-game
I am using PyPortMIDI and PyUSB, both of which I believe are wrappers for the C equivalents. I think this is all ok on Windows, but haven't tried.
What is currently on my github is crap, but it is proof-of-concept. I'm working on doing it properly now, with threading and proper configuration options.
The driver for the Nocturn makes it appear to system as a MIDI device, even though it isn't a USB MIDI device at the hardware level. The Automap software works entirely at the MIDI level, receiving MIDI instructions and sending different instructions in response - it is separate from the driver and not neccesary.
Alternatively, look at https://github.com/timoahummel/nocturn-game for an example of talking to it directly over USB from Python. You can probably port this to another language with libusb bindings.
Old thread, but I've just recently started looking into this.
I had a look at the Python application that dewert has written. Interestingly, it turns out that the data that the Nocturn emits is in fact MIDI, although it doesn't register itself as a USB MIDI device.
But looking at the actual data coming from the device, it actually emits control change messages (0xB0 controller value) for everything. Also the control commands that are sent to it are also control change messages, albeit only the data bytes, as the Nocturn seems to support MIDI running status (i.e. when sending multiple control change messages, it is not necessary to repeat the data byte).
Indeed, the looking at the magical initialization data it is actually just a bunch of control changes: it starts with 0xb0 and from there on the data comes in twos. For instance the last two bytes in the init string are 0x7f 0x00 which simply turn off the LED for the rightmost forward button. (There is something subtle happening as a result of the initialization being sent though, as the Nocturn sometimes emits some messages which appear to be some form of timeout events, and that behavior changes depending on whether the initialization string has been sent or not.)
Using MIDI-like messages makes sense, as Novation would be well aware of the MIDI protocol, so it would be easiest for them to use it for the communication even if the device is not strictly a MIDI device.
Note though that the incrementors just send the values 1 or 127, i.e. +1 or -1 step, so even with some trivial mapping software it's not really useful as it is. (Actually, if turned quickly, one can get 3 or 125 for instance, with the 125 corresponding to -3.) The only controller which sends a continuous value is the slider, which emits an 8 bit value when moved.
I suppose you'll want to know about USB classes in general and USB MIDI class in particular. The latter is the best what you can hope for in case you don't posess documentation for some proprietary protocol (whether it's used there instead).

Bonjour communication wrapper for Objective-C?

I've been using MYNetwork by the venerable Jens Alfke for an app of mine that allows devices to connect and share info over the network, it's actually a mission-critical part of the app. I tried writing my own wrapper for all of the C-level stuff you have to do for Bonjour, but it didn't work out so well, so I moved to MYNetwork.
It's been great so far, but the fact it's essentially opaque to me is causing trouble, as is that I want to move over to ARC once we can submit apps with it (there's a lot of Objective-C object references in structs, which ARC hates).
Can anyone recommend a similar wrapper, ideally that allows easy message passing between a client and a server over Bonjour as well as service discovery?
Just a thought- Would using ZeroMQ advertised and discovered by the stock NSNetService suffice? Separating the service pub/sub from the actual communication would allow you to use other bonjour libraries like Avahi on linux too. ZeroMQ is sufficiently simple to make wrapping trivial, yet powerful enough to cope with complex network topologies, fast.
I have experience with both technologies in isolation but not together although I see no reason why it wouldn't work. The only caveat right now is the limited body of collective experience of ZeroMQ use on iOS but I'd expect that to change over time.
You know you can disable ARC for specific files? So, you can just disable ARC for the library, and keep it on for your other files.
Disable Automatic Reference Counting for Some Files

MPSOC : Which OS do you use and why?

I'm working on MPSOC, specially STM ST40 (SH4 base) and ST231 and I'm wondering which OS i can use on these to port a parallel application, I already had a look at STLinux which is the STM distribution of a Linux platform for their MPSOC (which unfortunately doesn't work well for ST231 coprocessors) and I also had a look at OS21 which is a task based OS.
Any information about other RTOS are warmly welcome! (specially those with libc and pthreads :)
Those 4 came to my mind:
MicroC/OS-II: Its free and simple, but i think there are too few good resources available
LibeRTOS: I can recommend that. I used it several times for different projects. It's good it's fast and the dual kernel concept is really well done.
RTLinux: Can't tell you much about that one. Only used it once for a very small project and didn't get deep "behind the scenes" But it was fast and reliable. (and very expensive)
VxWorks: Awesome OS... From Wikipedia:
multitasking kernel with preemptive and round-robin scheduling and fast interrupt response
Memory protection to isolate user applications from the kernel
SMP support
Fast, flexible inter-process communication including TIPC
Error handling framework
Binary, counting, and mutual exclusion semaphores with priority inheritance
Local and distributed message queues
Full ANSI C compliance and enhanced C++ features for exception handling and template support
POSIX PSE52 certified conformance
File system.
IPv6 Networking stack
VxSim simulator
Supports: C/C++/JAVA
If money is no problem: Use VxWorks! You can do anything: Upgrade your fridge, built a war machine or fly to Mars ;-)
Otherwise check out LibeRTOS...
If you really want ot use an RTOS, be prepared to use a native API that is way more efficient and streamlined than pthreads...
I have used Micrium's µC/OS-II on several projects, on SH4 and a couple of different ColdFires. I continue to recommend it for new projects today.
Micrium has just announced a major upgrade to be called µC/OS-III that will add unlimited preemptively scheduled threads, as well as a round-robin scheduler for equal priority threads. It doesn't appear to be for sale yet, however.
If you need the capabilities, they also have a FAT file system, a PEG graphical UI library, USB device and host, and TCP/IP available for additional license fees.
Source code to everything is included in the price, and I've always found their support to be friendly and knowledgeable.
With the processors you mention you seem to be into set-top boxes.
You have the choice between the ST Linux distro, which is not very stable and the OSXX distro, which is proprietary for ST, but much more stable and with nice tools for debugging and the like (I'm not so sure about OSCC and libc/pthreads)
Barebones/AMP - because it allows 100% control and it allows the lowest latency.
Using Linux or FreeRTOS is very comfortable but it comes with a price tag.