CoreBluetooth with C++ - c++

I need to send data via bluetooth from iOS app into a C++ application. So
I have to implement Bluetooth module in c++, in iOS app using Corebluetooth framework.I created a wrapper class of bluetooth module for C++ app. I can call the iOS function from C++ application but, C++ doesn't have Corebbluetooth. Is it possible to create wrapper class for corebluetooth to use with C++ ?
If possible how to create the same?

Yes, that is possible.
You just need to create an Objective-C++ wrapper that forwards the messages to your C++ code. Objective-C++ allows you to use C++ code in your Objective-C classes. To use it, you either need to set the extensions of source files with your Objective-C wrapper from .m to .mm or set the sources to Objective-C++ in the File Inspector in Xcode.

Related

Can we use iOS framework like coremotion in c++ code

I need to build a library in C++, which have to get data from motion sensors. And then library in both android and iOS. It looks like it is possible to do it for android but I am struggling to find an answer for iOS.
You would be needing bridges for ios and android separately. Like for android you need different wrapper / JNI Bridge and different wrapper for ios Objective-c (.mm) files to used the sensor values. Ofcourse you can't share the sensor its different for each platform.
You can check this open source repository to get an idea how the wrappers around C++ and obj-c / Swift can be used.
https://github.com/foundry/OpenCVSwiftStitch
You can use C++ with iOS. The most typical way to do this is through hybrid "Objective-C++" files (.mm), which can compile C++ functionality in an Objective-C wrapper, but you can also use straight C/C++ source and C/C++ libraries. If you want your iOS app to be written in Swift (recommended), it can still use such code - I recommend wrapping the C++ in Objective-C(++) and calling the Objective-C wrappers from Swift with a bridging header.

Include Apple's SimplePing (Objective-C) in Qt C++ Project

ICMP ping for MacOS is not possible with Qt, because it would require raw sockets. There is however a SimplePing Objective-C code available from Apple, and a SimplePingHelper from Chris Hulbert:
https://developer.apple.com/library/archive/samplecode/SimplePing/Listings/Common_SimplePing_m.html#//apple_ref/doc/uid/DTS10000716-Common_SimplePing_m-DontLinkElementID_4
http://www.splinter.com.au/how-to-ping-a-server-in-objective-c-iphone/
https://github.com/chrishulbert/SimplePingHelper
My problem is that this is Objective-C, and not Objective-C++, and to use it with Qt I would need to wrap it into an Objective-C++ class where the header is pure C++ and the Objective-C/C++ SimplePing code in the .mm implementation of that class.
Although I managed to include other Objective-C++ code in Qt projects, I'm stuck with this.
(Alternatively, to use QProcess to run Ping is not desired, the overhead is too big for the volume of pings needed here.)

UWP Accessing WindowsRuntimeStreamExtensions class from C++?

I inherited a UWP application and I need to add additional functionality that needs to be implemented in C++. Therefore, I'm building a C++ WinRT assembly that will expose functionality that the existing UWP C# application will need to consume.
To that end, inside of that C++ WinRT project, I'm trying to make use of the [WindowsRuntimeStreamExtensions][1] class in a C++ file. I cannot seem to find a header file on my system which declares the WindowsRuntimeStreamExtensions class, and trying to reference it using the managed C++ keyword "using" as such:
#using <System.IO.dll>
..gives me the following compiler error:
"WinRT does not support #using of a managed assembly"

Can you still use C++ in Xcode?

I want to learn C++ on my Mac computer. A lot of forums recommend using Xcode, but when I downloaded it I realized that it only has options for Swift or Objective-C. Is there still a way to use C++ in Xcode?
The parts of a problem that interact with system APIs for making an app have to be Swift or Objective-C. (As such, the project templates that give you the bare skeleton of an app to get started with are only Swift and ObjC.)
However, an Objective-C app can use C++ internally. Just create .mm files instead of .m (or rename the ones you have from the project template) so that the compiler knows you're writing Objective-C++. Then you can write ObjC classes that create C++ objects or call into C++ libraries, write C++ classes or templates that store pointers to ObjC objects, etc.

Opening an objective c window from a C++ app

I have a C++ app that needs to send messages to google API's to do this I need to authenticate. I have a standalone Objective C authentication utility that is allowing me to do the authentication, but i'm not sure how to integrate it into the C++ app.
How do a trigger an Objective C window to load from C++
You can mix Objective-C and C++ code using Objective-C++. Simply just rename the file that uses both languages with an extension of .mm. Any other files that imports any Objective-c++ files will need to be renamed to .mm as well.