Chrisvanwyk

Badges

Third AnniversarySecond AnniversaryFirst AnswerXamarin Certified DeveloperXamarin University Professor First Anniversary5 Likes10 CommentsName DropperFirst Comment

About

Username
Chrisvanwyk
Location
US
Joined
Visits
662
Last Active
Roles
Xamarin Team, University, XamUProfessors, Developer Group Leader
Points
70
Badges
10

Chrisvanwyk Xamurai

About

Username
Chrisvanwyk
Location
US
Joined
Visits
662
Last Active
Roles
Xamarin Team, University, XamUProfessors, Developer Group Leader
Points
70
Badges
10
  • Re: Why does Objective Sharpie output a huge ApiDefinition.cs file for a very small library?

    @NashZhou

    I created the header file as you specified above and tested with Sharpie 3.4.0-c0f0e73

    My header file is located in this folder /Users/xxx/Projects/BindingTest/Headers running the following command from the /Users/xxx/Projects/BindingTest folder:

    sharpie bind -output TempBinding -namespace TempBinding -sdk iphoneos11.2 -scope Headers Headers/*.h -c -IHeaders -arch arm64

    This created an ApiDefinitions.cs in /Users/xxx/Projects/BindingTest/TempBinding.

    The contents from the ApiDefinitions.cs file is as follows:

    namespace TempBinding
    {
        // @interface MyView : UIView
        [BaseType (typeof(UIView))]
        interface MyView
        {
            // -(void)myMethod;
            [Export ("myMethod")]
            void MyMethod ();
        }
    }
    

    I believe you need to change your command line so that the -scope as well as the -l folder path passed to clang match the ~/Desktop/TempHeaderFolder your header file is located in .

  • Re: Why does Objective Sharpie output a huge ApiDefinition.cs file for a very small library?

    Hi @JonathanBachelor

    I have found that you need to limit the scope of the binding. Use the -scope pathTo/Headers parameter, assuming you have not done so already. If this does not help, share your simple lib and I'll have a look.

    I am also assuming Sharpie used a [Verify] attribute on the generated property? I am also assuming that your method had no parameters? In this case the convention is to convert the method into a property. If you do not want this syntax, you are welcome to modify the definition. This is why the [Verify] attribute is there.

    Best

  • Re: Sharpie 3.4.0 Bug

    Hi @MarkJackMilian

    Run pod --version if you see something like this

    -bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory then you may want to fix your Ruby and CocoaPods gem installs.

    I use Homebrew to manage my installs and took these steps:

    1. run brew up
    2. run brew install ruby
    3. run brew install CocoaPods

    Following all steps to make sure you already existing targets or link all conflicting files.

    Now run sharpie pod init ios AFNetworking

    Hope this helps.

  • Re: Sharpie failed: "Unable to handle compilation, expected exactly one compiler job''"

    Objective-Sharpie inspect and parse header files and does not parse static libraries.

    My suggestion would be to rewrite your command like this assuming you have an umbrella header file called lib.h :

    sharpie bind -output MyOutPutFolder -namespace MyBindingNameSpace -sdk iphoneos11.0 lib.h

  • Re: Peer-to-peer communication between Xamarin.Forms apps

    Hi John,

    The following repo will give you some insight to phone/tablet communication via BLE and BLE enabled devices.

    https://github.com/xamarin/Monkey.Robotics

    From this repo I would suggest looking at https://github.com/xamarin/Monkey.Robotics/tree/master/Sample Apps, specifically BLE Explorer. It is a Xamarin.Forms app that runs on iOS and Android devices and allows you to scan, connect, and read/write to BLE devices.

    This Wikipedia link http://en.wikipedia.org/wiki/Bluetooth_low_energy provides a high level overview on BLE and introduces the generic attribute profile, GATT, which will give you an idea of known profiles such a device may expose.

    Most or all of these profiles are covered in the BLE Explorer application. Some devices however will and do implement their own custom profiles.

    When it comes to these types of BLE devices your best option will be to bind the existing SDKs for iOS and Android into c# libraries you can us in Xamarin.iOS and Xamarin.Android, for example the Estimote iBeacon libraries on the Xamarin component store.

    When it comes to device-to-device communication, frameworks such as the iOS 7 introduced Multipeer framework exisit. Here is a Xamarin blog post introducing the framework, http://blog.xamarin.com/send-the-monkey-a-message-with-multipeer-connectivity/

    The problem with such a framework though is that it does not allow for communication to Android or Windows Phone from iOS devices.

    As a result developers tend to implement solutions, which includes a server component. A server framework such as signalR comes to mind to solve the server side requirements.

    You are at this point reliant on network connectivity and the solution will not work in dead-zone environment like you described above.

    A solution which looks promising is the AllJoyn SDK maintained/hosted by the Allseen Alliance. According to the website:

    “AllJoyn™ is a collaborative open-source software framework that makes it easy for developers to write applications that can discover nearby devices, and communicate with each other directly regardless of brands, categories, transports, and OSes without the need of the cloud.”

    https://allseenalliance.org/developers/learn

    I have not used this project myself and there is no Xamarin bindings available, but this does not mean it would be impossible to create such bindings.

    https://ask.allseenalliance.org/question/677/does-alljoyn-work-with-xamarin/

    I hope this information helps.

    Best,
    Chris