B4i Library iExternalAccessory - A flexible and customize way to connect MFi devices

iEATop.png

This library was built for create apps using devices with iAP protocol and MFi.

Installation instructions:

- Copy the *.a and *.h files into the folder "Libs" in your MAC or in your MAC HOSTED by AnywhereSoftware, normally in "B4i-MacServer\Libs" folder

-Copy the iExternalAccesory.xml to your custom libraries folder in B4i
- Select in your REFERENCED LIBRARIES

RefiEA.jpg

Version history:
V1.0.0 (First public release):
- Initial version

iExternalAccessory
Author:
Alberto Iglesias (alberto@visualnet.inf.br)
Version: 1
  • iExternalAccessory
    Events:
    • _ReadData (BytesReceived As String)
    • _onClose
    • _onConnected (Accessory As String)
    • _onDisconnected (Accessory As String)
    • _onOpen
    • _onStream (Event As String)
    • onInitialized (EventName As String)
    Methods:
    • EACloseSession
    • EAGetAccessories As NSString*
    • EAOpenSession:: (name As NSString*, protocol As NSString*) As Boolean
      Scan External Accessories
      -(void)EAScan;
    • EASendHex: (hextosend As NSString*) As Boolean
    • EASendText: (texttosend As NSString*) As Boolean
    • Initialize:: (bi As B4I*, EventName As NSString*)
      Initializes the object.
    • LicenseShow
      Show License
    • isConnected As Boolean
    Properties:
    • Author As NSString* [read only]
      Author of this Library
    • DebugMode As BOOL
      Enable/Disable Debug mode from Library
    • ErrorCode As Int [read only]
      Last Error Code
    • ErrorDescription As NSString* [read only]
      Last Error Description
    • LicenseEmail As NSString*
      License Email
    • LicenseKey As NSString*
      License Key
    • Version As NSString* [read only]
      Library Version

B4iEAShot2.jpg



* This version is fully functional, the only one difference is when send message, sometimes can be show a donation message.
Please consider a simple €10 donation and I send to you the Library without "Donationware" message alert.

Get the lastest version in http://vnsoft.es/store/

You can get your license key in our library store:

 

Attachments

  • EASample.zip
    3.2 KB · Views: 30
Last edited:

vincentehsu

Member
Licensed User
I used the hosted server,so I guess that i don't need to care about *.a and *.h files,right?
I've try to execute the sample EASample,First I connected to my device via BT,then I opened EASample,It always show "NOT CONNECTED",could u tell me how to use the library?
 

vincentehsu

Member
Licensed User
I've try to execute the sample EASample,First I connected to my device via BT,then I opened EASample,It always show "NOT CONNECTED",could u tell me how to use the library?
 

walterf25

Expert
Licensed User

walterf25

Expert
Licensed User

Turbo3

Active Member
Licensed User
My problem is with _ReadData (BytesReceived As String) .

Why is ReadData defined as returning a String when it is returning a pointer to a string?

The only thing that works on this "String" is Length. I can find no way to actually access the data being returned by ReadData.

When debug mode is enabled I can see all the bytes being received but I can find no way to get those bytes out of " BytesReceived ".

If you run the sample code for this library and do a "Log(BytesReceived)" you will get a pointer being printed not the actual string. Typing it as a String seems to make the actual string inaccessible. But this library has been around for some years so there must be a way to access the actual string.

Can someone provide some code as to how to convert the BytesReceived parameter into a real string instead of a pointer?

==================== Solution====================

Fixed by redefining the parameter to what it really is a byte array not a String. Documentation should be corrected.

_ReadData(BytesReceived() As Byte )
 
Last edited:

Turbo3

Active Member
Licensed User
Did not take long to find the next problem. This all being done using the above sample code provided.

After the ReadData returns the data it does not seem to clear it so the next time data is received it is just added to the end of the previous data.

This means the BytesReceived continues to increase in length returning all the previously received data plus the new data.

How are people clearing the BytesReceived so only new data is returned?

What am I missing here?

I am running version 1.0.6 of the Library and the Host Builder to compile.
 
Last edited:

Turbo3

Active Member
Licensed User
I am using an OBDLink MX+ OBDII adapter.

From my point of view the BytesReceived is not being cleared and includes the new data from the OBDLink MX+ concatenated to all the data previously sent.

Are you sure the library is clearing the BytesReceived variable once you give it to my app?
 

Turbo3

Active Member
Licensed User
Instead of receiving:
Data_1
Data_2
Data_3

I get:
Data_1
Data_1 Data_2
Data_1 Data_2 Data_3
 

Turbo3

Active Member
Licensed User
Great. Thanks.

That is the last thing I need working before I can integrate support for the OBDLink MX+ into my app. I have many users requesting this support.
 
Top