Invalid Argument while Creating Socket - android

I'm facing problem while creating a socket, with configuration as mentioned below,
Code :
sid = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
Error Details : Number - 22, String - Invalid argument
The error is not quite consistent. Out of 10 run this will happen for 3 - 4 times.
The code is compiled for the Android OS (For MAC & Windows platform it work for 10 out of 10).
Please suggest the possible reason and also fix for this.

Please check the permission of directory/path from where your executable run.
see this link for similar error and fix on windows
http://social.msdn.microsoft.com/Forums/en-US/wsk/thread/3076a9cd-57a0-418d-8de1-07adc3b486bb/

Related

Error building openframeworks for android: “ invalid use of incomplete type ‘class Poco::Path’”

I am trying to build an android application with OF. The application runs in two other computers. However, it does not work on mine. I am using a mac.
I run the command "make AndroidDebug" in the project folder, and this is the error I have:
/Library/openFrameworks/addons/ofxHTTP/libs/ofxHTTP/src/PostRouteFileHandler.cpp:98:46: error: invalid use of incomplete type 'class Poco::Path'
ss << Poco::Path(formFileName).getExtension();
I have installed poco, but nothing changes afterwards.
What can I do to solve this?
Thanks
Have you included Poco/Path.h?
A forward declaration might appeared earlier (possibly in another header) without complete definition.

Provisioning Nymi band from Android app

I am trying to provision the Nymi band from my android app. I am using the sample code from the Nymi Android SDK 2.0 (Can be downloaded from here:). I removed all the code related to the Nymulator(Nymi band emulator). I want to test the provisioning with the real Nymi band. However,when I click the provision button, the app get crashed. I tried to debug it with the exception breakpoints and I got the "getsockopt errno 88" error in my debugger:
I am attaching the screenshot too.
I did some research on google , and found that the errno 88 is
#define ENOTSOCK 88 /* Socket operation on non-socket */
During the app launch, I see the following message in the Debug Console:
Connected to the target VM, address: 'localhost:8604', transport: 'socket'
which I think,the connection to socket is fine. I am not sure,what makes the socket connection go wrong later.
This is what I see in my LOgCat after I click the provision button:(I am posting only some part of the error message,because the error message in Logcat is way too long)
Edit: I added some breakpoints,and I found where the app is crashing. I found this code:
try {
System.loadLibrary("_nymi_sdk_net");
_loaded = true;
} catch (UnsatisfiedLinkError var6) {
return false;
}
At system.load library, I am getting the error.
Edit 2: I changed the libraries from net to native ,as net is for emulators and native is for device. This time new error occurs at the same line:System.loadLibrary("_nymi_sdk");
Screenshot:
(Disclaimer: I know nothing of this SDK or the band, and this answer is just a speculation. And I've deleted my earlier answer as it was a missed shot in the dark.)
There is a minor hint in the SDK's README.md:
Prerequisites:
Android Development:
[...]
To use the BasicExample app with a Nymi Band, the NCL library in Examples\BasicExample\libs must be replaces with the native library in
NCL\native\libs
You must remove all files and folders from BasicExample\libs and copy all files from NCL\native\libs there instead.
(I wonder why they didn't emphasize this much harder...)
So the libs folder should contain the following folders and files:

Error while compiling libhardware_legacy

Two days ago i read some guides about how to self compile cyanogenmod and i wanted to try on my phone (Galaxy 3 i5800). The phone's CPU architecture is ARMV6 so i downloaded from androidarmv6.github.io the CyanogenMod 10.2 source code and from https://github.com/sdadier/cm10.1_device_samsung_apollo the device folder. At first compilation went pretty good except some "Selected Thumb mode not supported..." errors which i fixed by adding "-marm" CFLAG to involved Android.mk . However now i'm stuck on libhwardware_legacy compilation because i keep getting the error:
target thumb C: libhardware_legacy <= hardware/libhardware_legacy/wifi/wifi.c
hardware/libhardware_legacy/wifi/wifi.c: In function 'update_ctrl_interface':
hardware/libhardware_legacy/wifi/wifi.c:473:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
hardware/libhardware_legacy/wifi/wifi.c: In function 'wifi_start_supplicant':
hardware/libhardware_legacy/wifi/wifi.c:835:4: error: expected identifier before 'unsigned'
hardware/libhardware_legacy/wifi/wifi.c:895:20: error: dereferencing pointer to incomplete type
hardware/libhardware_legacy/wifi/wifi.c:912:26: error: dereferencing pointer to incomplete type
I searched on Google what that meant and i found lots of thread about this here on StackOverflow and on some Linux forums but none of them referred to Android, Cyanogen or libhardware_legacy. Is it a problem with my system? There is an error in the code (code here)?
Please give me some suggestion
OK! To fix the issue i removed "const prop_info *pi" and added this instead:
struct prop_info{
unsigned serial;
};
struct prop_info *pi;
but i think that if the system compiles it's not going to boot. However i will try to dump the libhardware_legacy from who compile CM10.1 successfully since the code is the same.
UPDATE: I probably found the main issue. The same error came up again and now there are 7 of them and the problem is that they are in the init so i can't workaround. However i noticed that wifi.c and property_service.c have an header in common sys/_system_properties.h probably the main error is there somewhere. Someone has a solution for this?

Printing by monodroid

I have a BIXOLON mobile printer, I can print by this device in windows mobile programs.
I want to print by this device in MONODOIRD applicaiton...
there is sdk, but the lib that use that sdk is java...
is any body know how can I print by this device in monodroid?!
Is your "lib" is a .jar file? If it is, bind it, which will make it accessible from C#.
after I read xamarin help about bindding jar file, I get some errors....
I listed in the end of this post...
I need this jar file compile completly...
Warning 1 missing class error was raised while reflecting com.bixolon.android.library.BxlService : android/hardware/usb/UsbManager
Warning 2 missing class error was raised while reflecting
com.bixolon.android.library.UsbLauncher : android/hardware/usb/UsbManager
Warning 3 For ConnectThread, could not find enclosing type 'BxlService'.
Warning 4 For ConnectThread, could not find enclosing type 'BxlService'.
Warning 5 For ConnectedThread, could not find enclosing type 'BxlService'.
Warning 6 For ConnectedThread, could not find enclosing type 'BxlService'.

arduino ADK + android LED blink example compiling errors

I'm trying to make a project using the arduino ADK board http://arduino.cc/en/Main/ArduinoBoardADK and a Sony Ericsson Xperia Play running android 2.3.4. For starters all I want to do is blink a led from my android device, using the nice tutorial found here http://allaboutee.com/2011/12/31/arduino-adk-board-blink-an-led-with-your-phone-code-and-explanation/ .I managed to compile the android app but I'm having big difficulties on the arduino sketch, I can't resolve the imports and it won't compile on Windows7. I understand there are some arduino IDE version issues. I tried compiling both on 0022, 0023 and on 1.0. The furthest I could go with the code I was getting these compile errors after editing the AndroidAccessory.h:
D:\arduino-0023\libraries\AndroidAccessory/AndroidAccessory.h:37: error: 'EP_RECORD' does not name a type
D:\arduino-0023\libraries\AndroidAccessory/AndroidAccessory.h:50: error: 'EP_RECORD' has not been declared
D:\arduino-0023\libraries\AndroidAccessory/AndroidAccessory.h:50: error: 'EP_RECORD' has not been declared
D:\arduino-0023\libraries\AndroidAccessory/AndroidAccessory.h:64: error: 'USB_NAK_LIMIT' was not declared in this scope
I think I read the whole documentation and I can't find a solution to my problem. Setting this up is such a pain... I really need to make this work. Thank you in advance! :)
---------------------------------------------------------------------------------------------------------------------------
EDIT1: The solution which worked for me was to compile the sketch on Linux (Ubuntu)
---------------------------------------------------------------------------------------------------------------------------
EDIT2: Once again using the newest USB library from arduino website the code DOESN'T compile. I tried compiling on IDE v22 and v1.0.2 running both Windows 8 and Ubuntu 12.10 with the following errrors:
E:\Development\arduino-1.0.2\libraries\UsbHost/AndroidAccessory.h: In function 'void setup()':
E:\Development\arduino-1.0.2\libraries\UsbHost/AndroidAccessory.h:68: error: 'void AndroidAccessory::powerOn()' is private
sketch_jan10a:16: error: within this context
E:\Development\arduino-1.0.2\libraries\UsbHost/AndroidAccessory.h: In function 'void loop()':
E:\Development\arduino-1.0.2\libraries\UsbHost/AndroidAccessory.h:66: error: 'int AndroidAccessory::read(void*, int, unsigned int)' is private
sketch_jan10a:23: error: within this context
The library was written and tested in:
Arduino Alpha 0022
Have you tried adding this to ArduinoAccessory.h?
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
Also I would recommend reading through this as well:
http://developer.android.com/guide/topics/usb/adk.html#installing
It specifically mentions you need the CapSense library as well for the Android shield on an Arduino:
http://www.arduino.cc/playground/Main/CapSense
It also mentions that you need to install avr-libc as well:
sudo apt-get install avr-libc
MAC OS X:
fink install avr-libc avr-gcc avr-binutils avrdude
EP_RECORD is defined as part of the USB Host Shield 1.0. However, it is being removed in USB Host Shield 2.0 library.
See the announcement here: http://www.circuitsathome.com/mcu/usb-host-shield-library-version-2-0-released
So the error messages you have with EP_RECORD will surface again if you ever upgrade to 2.0. Also check out the adk.h and adk.cpp from version 2.0 on GitHub. The updated DemoKit 2.0 example no longer use the AndroidAccessory.h/.cpp.
Sounds to me like you're just missing the USB_Host_Shield/Usb.h header, which defines those constants.
Place this code where other defines are in Usb.h
#define USB_NAK_LIMIT 32000 //NAK limit for a transfer. 0 means NAKs are not counted
Place this just after SETUP_PKT's typedef in Usb.h
/* Endpoint information structure */
/* bToggle of endpoint 0 initialized to 0xff */
/* during enumeration bToggle is set to 00 */
typedef struct {
byte epAddr; //copy from endpoint descriptor. Bit 7 indicates direction ( ignored for control endpoints )
byte Attr; // Endpoint transfer type.
unsigned int MaxPktSize; // Maximum packet size.
byte Interval; // Polling interval in frames.
byte sndToggle; //last toggle value, bitmask for HCTL toggle bits
byte rcvToggle; //last toggle value, bitmask for HCTL toggle bits
/* not sure if both are necessary */
} EP_RECORD;
I think if we really know what this EP_Record epRecord[8]; is all about that might help. EP_Record has not been declared in this file. Therefore, it does not have a type. When I gave USB_NAK_LIMIT a type of int that error went away. I have no idea what type to give to EP_Record? The only thing I can think of is that it might be an array epRecord[8]; looks like an array.
While the Android Developer's site is useful it does lack in many ways. One would be some online help for developers. This seems the be the only source for answers to questions and most of them do not really solve the problems.
This sounds kind of like a issue I had a while ago.
(so I used microbridge not the ADK with a USBDroid) I had to
go into 3 libraries, The error message pointed me to them
//(Note:Which were copied into the the general arduino sketch folder not the arduino normal libraries location) That may be your issue?)
I then replace wiring.h with Arduino.h in each.(Note Make a backup of all to save some stuffing around if this is not your issue) Copy then into a folder named the same but with a number before the name that way when you restart the arduino software you will get a error ignore this and compile.
The result was working USBdroid as seen at
http://www.youtube.com/watch?v=h7aa_6PNdRI
Still a Work in progress but made me happy. I still have a few buggs to work out.
Cheers,
Al
Install ArduinoADK BETA 001 which is the latest ADK available till date.
Unzip it and in the arduino folder you will find libraries and libraries-V2.
If you copy USB host in libraries you will get androidaccessory.h read private error
Copy USB host from libraries V 2 you should be able to compile successfully. I was.

Categories

Resources