1

I need to send bin file to the Alljoyn enabled board from Android. What is the standard way to transfer it through Alljoyn.

Robin Royal
  • 1,788
  • 1
  • 18
  • 29

2 Answers2

1

AJ has payload limitation so file needs to be sent in chunks. You can see example how it can be implemented using Alljoyn signals in this C++ sample: https://cgit.allseenalliance.org/core/test.git/tree/scl/bbftp.cc

  • Thank You but I need to have small sample for Android. – Robin Royal Feb 21 '17 at 06:00
  • Android sample may not exists but the idea would be the same: split file into chunks and sent each chunk as a separate signal with "ay" signature (array of bytes). – Krystian Z. Feb 24 '17 at 11:06
  • Krystian, Signal will be recived from board. I have added a method in the AirPurifier Interface. @BusMethod public void SendSoftwareUpgradeFileWithCurrentIndex(int index, byte[] data) throws BusException; above method displays these errors 1. https://drive.google.com/open?id=0B7OGoxSpiKCdUTgyZlRyaU9JNWM 2. https://drive.google.com/open?id=0B7OGoxSpiKCdN1RKQi1Bc09BSm8 – Robin Royal Mar 01 '17 at 06:57
  • @Robin, the error seems to imply that the Consumer is attempting to communicate with the Producer via a stale bus name. I suspect that the Producer has re-attached to the bus and now has a different bus name, while the Consumer is still attempting to use the previous bus name. – P. Sigurdson Mar 02 '17 at 19:43
  • @Robin, I have also seen this similar error (using AllJoyn Ping) when the Consumer had moved outside the wifi network and received a Lost Advertisement, and then re-entered the wifi network but didn't receive a Found Advertisement. The Consumer's AllJoyn gateway no longer has this bus name in its list and so will claim it doesn't exist if Consumer attempts to later communicate using it (even though the Producer is in fact still using that bus name). This failure may be confined to AllJoyn Ping. – P. Sigurdson Mar 02 '17 at 19:54
  • @Krystian Thank you so much for you reply. using my above code I'm able to write the byte[] into the memory of the board. The Issue I'm facing at the moment is c language's code is using unsigned interger while getting the index number but Android (Java) uses the signed Interger. How can I send Unsigned integer from Android to c code. – Robin Royal Mar 03 '17 at 07:51
1

There has been some discussion of this in other forums in the past. The consensus seems to be to chunk and send via AllJoyn signals.

There is a java FileTransferModule library and corresponding FileTransferSample android app that was contributed to AllSeen Alliance several years ago (this git repo is in archive state now). It transfers files by chunking them and sending the chunks via AllJoyn signals. The project hadn't been updated in some time and wasn't running on Android 6, so I forked and fixed it. You can find the forked version on my github.

Here is the link to the updated FileTransferModule library:

https://github.com/psigurdson/alljoyn-services-filetransfer/tree/master/Java/FileTransferModule/src/org/alljoyn/cops/filetransfer

All of the supported functionality of this library is intended to be accessed through the FileTransferModule class. Here is a brief description of its functionality from the FileTransferModule.java file comment:

The File Transfer Module is a library that provides application developers with a simple framework they can use to send and receive files with the various peers within their AllJoyn session. This module is designed to be utilized with any existing AllJoyn application with little, to no, modification. The framework provides many different operations to the application developer that include: announce/unannounce files to session peers, requesting file announcements from other peers, request file by file ID and by absolute path, cancel/pause file transfer, and offering files to a specified peer. There are also a series of listeners that allow the developer to be notified at the application level when various events occur; such examples include: an announcement being received by a session peer, a file transfer has completed, a session peer has offered you a file, or a file request by path has been received. The listeners allow the developer to respond accordingly to the various events. Furthermore, the user has tremendous flexibility through the ability to change the current AllJoyn sesion associated with File Transfer. This allows users to instantiate multiple instances of the File Transfer Module and specify a different AllJoyn session for each.

Side Note: There use to be some basic C++ and iOS FileTransfer samples in AllJoyn Core, but these have since been removed. If you wanted to you could go back and look at these older AllJoyn release branches to see how their algorithms compare.

RB14.06
alljoyn_core/samples/FileTransfer/

RB15.04
alljoyn_objc/samples/iOS/FileTransferClient/
alljoyn_objc/samples/iOS/FileTransferServer/
P. Sigurdson
  • 151
  • 4