Can I write device driver for iOS in C++? - c++

I came up with a project that requires me to write a driver for a micro-controller connected to an iPhone via the lightning port. Is it possible to write the driver at all, if I don't plan on releasing it to the App Store?
Also, my second question is: What language do I have to use? I'm pretty familiar with C++ and I'm completely new to Apple devices, so I have no idea if I need to use Swift.

It's not possible to write drivers for iOS. The only way to access the port (and Bluetooth classic) is the External Accessory Framework.
Some common accessory features are accessible through other frameworks like Game ControllerFramework. The WWDC2013 Designing Accessories for
iOS and OS X and WWDC2014 lists some of the frameworks you can use to interact with accessories.
You need MFi as a hardware vendor and for the AppStore (you need to provide your custom protocol string/s, if any). The program provides detailed information about the iPod Accessory Protocol (iAP).
Maybe you can find this SO question useful USB-Programming on iPhone

Related

How do I connect my app to bluetooth when multiple coding languages are involved?

Our team wants to create a game. We think c++ should be the language (so we can use Unreal Engine to develop), but we want the game to be multi-platform (game consoles, iPhone, etc.). The game will require bluetooth connections with an external device. What communicates with bluetooth? The c++, or Swift/Java (or whatever is running on the platform)?
My recommendation is to use the native language for each platform. In other words, use C++ as you originally planned, swift for iOS, Java/Kotlin for Android, etc. It might theoretically take you longer to develop, but these native languages will end up being more versatile/powerful, and you will find a lot of resources that help you in your development. That being said, if you wanted a common language with Bluetooth functionality across multiple platforms, then Xamarin is the closest thing to being that. Not sure how much you can use it to develop a game, but it will give you some level of interoperability. Have a look at the links below for more information:-
What is Xamarin
Use C/C++ Libraries with Xamarin
Xamarin vs Native App Development: Pros and Cons
Bluetooth LE for Xamarin

How can i access and control hardware in Qt

I try to developing simple scada system with C++ in Qt. I want to control hardware or get status(or something) of hardware and send to server or router.(actually my application control softwares too)
And in finish: Qt have a good tools for scada systems?
As of QT 5.7 there is a new Serial Bus library for use with protocols such as CAN BUS and MODBUS, you can read more about it here:
http://doc.qt.io/qt-5/qtserialbus-index.html
For your scenario, QT has plenty of Network support that you could use for your interface, depending on what your hardware specification is. QT does not compare to 'out of the box' SCADA solutions such as a Siemens SCADA system, however developing one based on QT could give you much more flexibility. Depending on what you are trying to achieve, this becomes a trade-off between productivity/time to market and flexibility/value add.
Also there is an opensource qt scada toolkit https://github.com/IndeemaSoftware/QSimpleScada, for visualization.

LabVIEW Linux C++ development - beginner questions

Background
In our company we cooperate with manufacturer of machinery, we are developing C++/Qt crossplatform control applications for devices that they produce. In the past, we used to communicate with their devices through USB (virtual COM port). Now we were informed that this manufacturer plans to switch to LabVIEW (USB Data acquisition). Of cause we will receive relevant information in the future, nevertheless I would like to get some information about it and ask you question which i could not find on internet easily.
I am sorry for noob questions.
Questions
1) What is LabVIEW? Am I right that it is not a single piece of device, but bunch of hardware components, drivers and standards?
2) Who is LabVIEW developer? I have read How much time do I need to learn LabVIEW, but I am not sure. Is it a person who puts LabVIEW components together and makes firmware for them. Or a person who develops toplevel user applications that communicate with LabVIEW?
3) I assume that first part from Question2 would be done by our partner company. Second part will be upon us. But who creates communication protocol? Is there any standard way how DAQ communicates with its PC drivers, or is it upon programmer to develop communication protocol?
4) I have found there is driver for linux at National Instruments. Contains this driver some API/libraries that can be included in C++ code in a standard way and utilized to communicate with DAQ?
LabVIEW is a development environment for creating custom applications that interact with real-world data or signals in fields such as science and engineering. LabVIEW itself is a software development environment that contains numerous components:
G Programming: flowchart-like dataflow programming model
Hardware support: Support for thousands of hardware devices like scientific instruments, data acquisition devices, sensors, cameras, ...
Analysis and technical code libraries: Libraries for signal processing, communication, file I/O, control algorithms, ...
UI components and reporting tools: controls such as graphs, gauges, and tables to view your acquired data and tools to save data to file or databases, or automatically generate reports
Technology abstraction: Using technologies such as FPGAs, multicore CPUs, ...
Models of computation: When G is not appropriate simulation syntax, textual math, statecharts, component-level IP (CLIP) nodes, DLL calls, ... are available
LabVIEW is developed and maintained by National Instruments. It stands behind LabVIEW with comprehensive support, training, and certification options.
LabVIEW makes the process of integrating hardware much easier by using a consistent programming approach no matter what hardware you are using. LabVIEW has freely available drivers for thousands of NI and third-party hardware. In the rare case that a LabVIEW driver does not already exist, you have tools to create your own, reuse a DLL or other driver not related to LabVIEW, or use low-level communication mechanisms to operate hardware without a driver.
LabVIEW is also cross-platform and allows you to deploy your code to many different computing platforms like popular desktop OSs (Windows, Mac, and Linux), embedded real-time controllers, ARM microprocessors, and field-programmable gate arrays (FPGAs).
By the sounds of it you don't need to learn LabVIEW (which is a pity), but you need to learn daq-mx the hardware driver suite by National Instruments. I have no experience with the Linux version (which is a trimmed down or base version of the Windows one), but it basically is a set of dll's or so's that allow you to communicate with their hardware. Try to find out what hardware they are going to use and see if daq-mx base supports simulated devices.

Code example for virtual HID (Human Interface Device)

I need example of code (or some tutorial) for making virtual HID (Human Interface Device).
If possible with bluetooth integration and made for linux using QT/C++.
Practically, I want to make my own cellphone application which will have few buttons (but it will work as keyboard - sending keystrokes), without requiring server-side application (it will control windows/linux/mac operating systems), and HID seems to me best choice. Unfortunately, I can't find any code samples or tutorials for that.
The thing is I don't know how I am supposed to make service and register it (make it available over bluetooth so OS can recognize it as keyboard and pair with it).
So far I have found about BlueZ, but as I mentioned, I cant find any code samples or tutorials.
UPDATE: I am trying to make my cellphone (Nokia N9 - Maemo 6/MeeGo OS - Linux) to pretend as HID device via BlueTooth so I can send keystrokes to PC.
The first question that comes into my mind is this usb device made by you ?
I don't understand what making my own cellphone application means . So you have a device that is a cell phone or what please be more explicit
Anyway a solution for you might be the libusb library works very well on both windows and linux machines.
If you need to study about usb hid devices and how to interact with them you can find a lot of very good tutorials here.
Please be more explicit in order to help you.

Network driver over ethernet IOKit Cocoa

I have writen an objective-c POS that needs to interact with many ethernet devices like barcode scanner, fuel pump, cash drawer, etc. I know i'll probably have to write drivers in c++ for each device. The problem is I have no idea of how to write ethernet devices drivers. Is there anybody who can help me?
Btw, I haven't seen any code sample for ethernet drivers on the Apple dev site.
Thanks in advance!
If the platform your working with is running iOS or MacOS, then it already has an Ethernet driver and a TCP/IP stack. What you probably need to write are modules/classes that communicate with the various devices using a socket API. These modules/classes are written at the application level, and are not OS device drivers.
To use sockets on iOS/MacOS, you can work with either the CFNetwork framework, or more directly with BSD sockets. There is lots of literature and examples on socket programming. There is not as much litterature on CFNetwork, but CFNetwork has the advantage of being easier to integrate with your app's run loops.
Check out this answer that lists resources for learning sockets network programming.
A third option would be to use the Boost.Asio library, which is "a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach". This documentation page shows several examples on how to use asio. You can use Objective-C++ (with *.mm files) to mix Objective-C with C++.