Go to advanced search

by lihakimpale
Sat May 14, 2016 7:33 am
Forum: Java
Topic: Android Bluetooth `InputStream` doesn't receive data
Replies: 2
Views: 2592

Re: Android Bluetooth `InputStream` doesn't receive data

Thanks for the reply.

I have invoked the default constructor and then by calling the start() method it'll invoke the run() thread method.

Code: Select all

clientTransferThread = new BluetoothTransferThread((BluetoothSocket)msg.obj, BluetoothClientActivity.this, threadHandler);
clientTransferThread.start();
by lihakimpale
Thu May 12, 2016 11:20 am
Forum: Android
Topic: Android Bluetooth `InputStream` doesn't receive data
Replies: 0
Views: 427

Android Bluetooth `InputStream` doesn't receive data

I have a Raspberry Pi which I am using to read some sensor data and then trying to send that data through Bluetooth RFCOMM socket to Android phone. I can send data from the Android phone to the Raspberry Pi without problems but for some reason I am not able to read the sensor data with the Android p...
by lihakimpale
Tue May 10, 2016 11:17 am
Forum: Java
Topic: Android Bluetooth `InputStream` doesn't receive data
Replies: 2
Views: 2592

Android Bluetooth `InputStream` doesn't receive data

I have a Raspberry Pi which I am using to read some sensor data and then trying to send that data through Bluetooth RFCOMM socket to Android phone. I can send data from the Android phone to the Raspberry Pi without problems but for some reason I am not able to read the sensor data with the Android p...
by lihakimpale
Wed Mar 02, 2016 4:29 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: I2c detect adress
Replies: 2
Views: 424

Re: I2c detect adress

Check the connections. The i2cdetect -y 1 should detect the chip if the connections are ok and you don't need the device address for that. Have you installed the i2c-tools?
by lihakimpale
Wed Dec 16, 2015 10:18 am
Forum: C/C++
Topic: Linux Socket poll()
Replies: 13
Views: 2314

Re: Linux Socket poll()

You've not provided enough code - i.e. how is the class TCP_Socket related to MainWindow? I'm assuming MainWindow inherits TCP_SocketClient. That's true. I am still little newbie with C++. So when class is derived from another class I can call the certain method in the parent class without creating...
by lihakimpale
Tue Dec 15, 2015 7:22 pm
Forum: C/C++
Topic: Linux Socket poll()
Replies: 13
Views: 2314

Re: Linux Socket poll()

Not sure how your code copes (not at home now to check), but what happens if the client doesn't receive the full sensor data in one go - recv() may have only partially read the data passed.
I sent 5 bytes and client received 5 bytes. No problems at all.
by lihakimpale
Tue Dec 15, 2015 6:01 pm
Forum: C/C++
Topic: Linux Socket poll()
Replies: 13
Views: 2314

Re: Linux Socket poll()

Maybe the client is trying to send 4 bytes, is it the same byte each time? My version I changed m_sendBuf to be 2 chars long with unsigned char m_sendBuf[1];. Maybe you accidentally set the type to be int? This then happens (added printing the actual char read) - edit the byte order may be differen...
by lihakimpale
Tue Dec 15, 2015 4:20 pm
Forum: C/C++
Topic: Linux Socket poll()
Replies: 13
Views: 2314

Re: Linux Socket poll()

Is this what you are seeing? Quite similar but I am receiving 1 byte 4 times. Looking to that output you have got it seems that you are having more than one connection. I have always created just one connection and then looped the recv/send. Does every recv/send always need new connection to be cre...
by lihakimpale
Tue Dec 15, 2015 12:05 pm
Forum: C/C++
Topic: Linux Socket poll()
Replies: 13
Views: 2314

Re: Linux Socket poll()

Thank you for the reply! Did I forget to mention that it polls fine once but when you want to poll multiple messages the server starts to receive the client's one byte always four times until it send the reply message. So after the first poll the server always receives the byte four times and then s...
by lihakimpale
Mon Dec 14, 2015 5:55 pm
Forum: C/C++
Topic: Linux Socket poll()
Replies: 13
Views: 2314

Re: Linux Socket poll()

I just tested the system without the Qt and it seems to poll almost correctly. For some reason it receives the sent byte four times and then sends the data.
by lihakimpale
Mon Dec 14, 2015 5:42 pm
Forum: C/C++
Topic: Linux Socket poll()
Replies: 13
Views: 2314

Re: Linux Socket poll()

I was hoping that someone could have been able to say where the problem is just by looking the code. I think there isn't big problem. TCP_SocketServer.c: #include "TCP_Socket.h" int SendAndReceiveSocketData(void) { int on = 1; struct sockaddr_in server; struct pollfd fds[10]; int timeout, close_conn...
by lihakimpale
Mon Dec 14, 2015 3:07 pm
Forum: C/C++
Topic: Linux Socket poll()
Replies: 13
Views: 2314

Linux Socket poll()

I am running socket server on my Raspberry Pi and socket client on my desktop Ubuntu where I have the GUI of the system made with Qt. I am using socket poll() function on the server side to wait certain command from the GUI when pressed button widget but at the moment for some reason I am able to po...
by lihakimpale
Sat Sep 19, 2015 3:14 pm
Forum: C/C++
Topic: Weird compiling error
Replies: 10
Views: 1459

Re: Weird compiling error

Thank you Paeryn! Now it compiles!
by lihakimpale
Sat Sep 19, 2015 1:03 pm
Forum: C/C++
Topic: Weird compiling error
Replies: 10
Views: 1459

Re: Weird compiling error

Ok, I converted the C++ code to C code. It is much easier this way. But I'm still getting compilation error. I have previously compiled just the mysql code with this command line option: `mysql_config --cflags --libs` and it compiled without erros. I wasn't sure how to add that `mysql_config --cflag...
by lihakimpale
Sat Sep 19, 2015 11:16 am
Forum: C/C++
Topic: Weird compiling error
Replies: 10
Views: 1459

Re: Weird compiling error

DougieLawson wrote:Try searching Google for your compiler error. It turns up an interesting solution.

https://github.com/youbot/youbot_applications/issues/3
Do you mean that it would work by including that header #include "boost/date_time/posix_time/posix_time.hpp" beacause it isn't.
by lihakimpale
Sat Sep 19, 2015 11:12 am
Forum: C/C++
Topic: Weird compiling error
Replies: 10
Views: 1459

Re: Weird compiling error

Maybe you could help me with my code that I'm not going to show you ? :roll: ;) Without seeing the code you are compiling how do you expect anyone to be able to help ? We don't even know what header files have been included before the error ! BTW C++ error messages are never easy to understand (in ...
by lihakimpale
Sat Sep 19, 2015 7:55 am
Forum: C/C++
Topic: Weird compiling error
Replies: 10
Views: 1459

Re: Weird compiling error

Sorry, I should have been more precise. There shouldn't be errors in my code because that is exactly the same code which I compiled without errors in Eclipse IDE with arm-linux-gnueabihf. I am getting that error when compiling straight on a Raspberry Pi and it isn't even my code where it is pointing...
by lihakimpale
Fri Sep 18, 2015 6:03 pm
Forum: C/C++
Topic: Weird compiling error
Replies: 10
Views: 1459

Weird compiling error

Hi, I'm getting this very weird compiling error and I don't have any clue how to fix it. g++ -Wall -I/usr/include/mysql -std=c++0x -c main.cpp -o main.o In file included from /usr/include/c++/4.6/bits/locale_facets_nonio.h:1936:0, from /usr/include/c++/4.6/locale:43, from /usr/include/c++/4.6/iomani...
by lihakimpale
Tue Sep 15, 2015 9:59 am
Forum: C/C++
Topic: MySQL C API mysql_query
Replies: 5
Views: 1709

Re: MySQL C API mysql_query

Thank you for your replies!

Yes hexelpdkk, that's true! I have a weather station application where I read pressure, temperature and humidity.

Ok, I will forget the prepared statement API and keep it simple.
by lihakimpale
Mon Sep 14, 2015 5:14 pm
Forum: C/C++
Topic: MySQL C API mysql_query
Replies: 5
Views: 1709

Re: MySQL C API mysql_query

Thank you for the reply!

On another forum they suggested to do it with the prepared statement API to reduce possible SQL injection.http://lgallardo.com/en/2011/06/23/sent ... -completo/

What are your thoughts about that?
by lihakimpale
Thu Sep 10, 2015 2:12 pm
Forum: C/C++
Topic: MySQL C API mysql_query
Replies: 5
Views: 1709

MySQL C API mysql_query

Hi, I have two problems with the MySQL C API. How do I get variable to be added to the table when I do the mysql_query() and how do I get the table show decimals? Thank you! Here is my code: void insertDataToTable(MYSQL* con, float temp, int k) { mysql_query(con, "INSERT INTO Weatherstation VALUES(@...
by lihakimpale
Fri Jun 12, 2015 3:24 pm
Forum: C/C++
Topic: Converting an array of ASCII to an integer
Replies: 11
Views: 1846

Re: Converting an array of ASCII to an integer

Oops there was big mistake in the condition of the do while loop. Now it really reads the next 5 bytes without reading again the first byte. Here is how it looks now: #include <stdio.h> #include <unistd.h> //Used for UART #include <fcntl.h> //Used for UART #include <termios.h> //Used for UART #inclu...
by lihakimpale
Fri Jun 12, 2015 1:59 pm
Forum: C/C++
Topic: Converting an array of ASCII to an integer
Replies: 11
Views: 1846

Re: Converting an array of ASCII to an integer

Not quite there yet. This while loop will work some of the time - but not for the right reasons. //Read characters until carriage return is read do { read(uart0_filestream, &serial_data, sizeof(serial_data)); }while(serial_data.end == 13); You've already read the first 'R' from the stream so your s...
by lihakimpale
Thu Jun 11, 2015 4:54 pm
Forum: C/C++
Topic: Converting an array of ASCII to an integer
Replies: 11
Views: 1846

Re: Converting an array of ASCII to an integer

Ok, thank you for helping me. Here is my latest version of the code. I made some research and decided to use strtol() function instead of scanf for converting the string to an integer. #include <stdio.h> #include <unistd.h> //Used for UART #include <fcntl.h> //Used for UART #include <termios.h> //Us...
by lihakimpale
Tue Jun 09, 2015 5:54 pm
Forum: C/C++
Topic: Converting an array of ASCII to an integer
Replies: 11
Views: 1846

Re: Converting an array of ASCII to an integer

Thank you for your replies. Sorry, but I am still quite a newbie with the serial communication. I'm not sure if I understood the parsing of the byte stream but here is my new code. I made little change to the data structure to where I store the data. #include <stdio.h> #include <unistd.h> //Used for...

Go to advanced search