Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Commit of MQTT-SN Gateway #10

Merged
merged 2 commits into from Jun 23, 2016

Conversation

Projects
None yet
2 participants
@ty4tw
Copy link
Contributor

ty4tw commented May 13, 2016

Signed-off-by: tomoaki tomoaki@tomy-tech.com

@ty4tw

This comment has been minimized.

Copy link
Contributor Author

ty4tw commented May 13, 2016

This gateway has one bug of segmentation fault.
However, It works. I made a pull request to accelerate the developing.

BUG Report

20160513 070708 PUBLISH 008C ---> Client01 32 2E 00 09 74 79 34 74 77 2F 74 70 31 00 8C 99 1E D1 00 FF D2 00 01 11 70 A6 61 62 63 64 65 66 F0 D0 C4 D1 FE D4 D2 FF FE EE 90 CA 44 7A 00 A4
20160513 070709 PUBACK 008C <--- Client01 40 02 00 8C
PacketHandleTask gets PUBACK 008C from the broker.
20160513 070709 PUBACK 008C ---> Client01 0D 00 02 00 8C 00

20160513 070709 PUBLISH 0037 <--- Client01 32 2E 00 09 74 79 34 74 77 2F 74 70 31 00 37 99 1E D1 00 FF D2 00 01 11 70 A6 61 62 63 64 65 66 F0 D0 C4 D1 FE D4 D2 FF FE EE 90 CA 44 7A 00 A4
PacketHandleTask gets PUBLISH 0037 from the broker.

20160513 070709 PUBLISH 0037 ---> Client01 0C 20 00 01 00 37 99 1E D1 00 FF D2 00 01 11 70 A6 61 62 63 64 65 66 F0 D0 C4 D1 FE D4 D2 FF FE EE 90 CA 44 7A 00 A4

20160513 070746 PUBLISH 008D <--- Client01 0C 20 00 03 00 8D 93 CE 57 34 FE B2 64 A5 4B 6F 68 6F 6D
PacketHandleTask gets PUBLISH 008D from the client.
20160513 070746 PUBACK 0037 <--- Client01 0D 00 01 00 37 00
PacketHandleTask gets PUBACK 0037 from the client.

20160513 070746 PUBLISH 008D ---> Client01 32 1E 00 0D 74 79 34 74 77 2F 73 6F 69 6C 52 65 67 00 8D 93 CE 57 34 FE B2 64 A5 4B 6F 68 6F 6D
==8724== Thread 6:
==8724== Invalid read of size 8
==8724== at 0x413860: MQTTSNGW::Event::getClient() (in /home/tomoaki/tmp/MQTTSN-embedded-C)
==8724== by 0x40B85E: MQTTSNGW::BrokerSendTask::run() (in /home/tomoaki/tmp/MQTTSN-embedded-C)
==8724== by 0x40B988: MQTTSNGW::BrokerSendTask::EXECRUN() (in /home/tomoaki/tmp/MQTTSN-embedded-C)
==8724== by 0x4079B9: MQTTSNGW::Thread::run(void) (in /home/tomoaki/tmp/MQTTSN-embedded-C)
==8724== by 0x4E3F181: start_thread (pthread_create.c:312)
==8724== by 0x5CA447C: clone (clone.S:111)
==8724== Address 0x8 is not stack'd, malloc'd or (recently) free'd
==8724==
==8724==
==8724== Process terminating with default action of signal 11 (SIGSEGV)
==8724== Access not within mapped region at address 0x8
==8724== at 0x413860: MQTTSNGW::Event::getClient() (in /home/tomoaki/tmp/MQTTSN-embedded-C)
==8724== by 0x40B85E: MQTTSNGW::BrokerSendTask::run() (in /home/tomoaki/tmp/MQTTSN-embedded-C)
==8724== by 0x40B988: MQTTSNGW::BrokerSendTask::EXECRUN() (in /home/tomoaki/tmp/MQTTSN-embedded-C)
==8724== by 0x4079B9: MQTTSNGW::Thread::run(void) (in /home/tomoaki/tmp/MQTTSN-embedded-C)
==8724== by 0x4E3F181: start_thread (pthread_create.c:312)
==8724== by 0x5CA447C: clone (clone.S:111)
==8724== If you believe this happened as a result of a stack
==8724== overflow in your program's main thread (unlikely but
==8724== possible), you can try to increase the size of the
==8724== main thread stack using the --main-stacksize= flag.
==8724== The main thread stack size used in this run was 8388608.
==8724==
==8724== HEAP SUMMARY:
==8724== in use at exit: 25,873 bytes in 140 blocks
==8724== total heap usage: 5,833 allocs, 5,693 frees, 185,715 bytes allocated
==8724==
==8724== LEAK SUMMARY:
==8724== definitely lost: 501 bytes in 24 blocks
==8724== indirectly lost: 1,012 bytes in 57 blocks
==8724== possibly lost: 1,546 bytes in 8 blocks
==8724== still reachable: 22,814 bytes in 51 blocks
==8724== suppressed: 0 bytes in 0 blocks
==8724== Rerun with --leak-check=full to see details of leaked memory
==8724==
==8724== For counts of detected and suppressed errors, rerun with: -v
==8724== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

@icraggs

This comment has been minimized.

Copy link
Contributor

icraggs commented May 23, 2016

Thank you very much for the work Tomoaki! As this is a big contribution, it has to go through the Eclipse IP process before I can accept it. I've opened a request for review with the Eclipse legal team. There are a couple of questions I need to ask as part of that:

  1. I think you wrote all of this yourself? (Or were there any other contributors?)
  2. Do you work for an organization? The contribution process asks me that.

Thanks!

@icraggs

This comment has been minimized.

Copy link
Contributor

icraggs commented May 23, 2016

FYI, because the Eclipse simultaneous release cycle is nearing its end (in June), the review may well take longer than normal.

@ty4tw

This comment has been minimized.

Copy link
Contributor Author

ty4tw commented May 23, 2016

Hi Ian,

  1. I think you wrote all of this yourself? (Or were there any other
    contributors?)
    I wrote this by my self. no other contributors.

  2. Do you work for an organization? The contribution process asks me that.
    No I don't. I am a jobless person.

I know the project situation. I just wait and see.

tomoaki

2016-05-23 20:14 GMT+09:00 Ian Craggs notifications@github.com:

FYI, because the Eclipse simultaneous release cycle is nearing its end (in
June), the review may well take longer than normal.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#10 (comment)

@icraggs

This comment has been minimized.

Copy link
Contributor

icraggs commented May 24, 2016

Thanks Tomoaki.

One of the reviewers has observed that the code is using wiringPi. This wouldn't work on every Linux, so I imagine we could have it in a Raspberry Pi specific sample? Are there any other external libraries that are used? I have to note each library in the contribution documents.

@ty4tw

This comment has been minimized.

Copy link
Contributor Author

ty4tw commented May 24, 2016

Hi Ian,

it's not a Raspberry Pi specific.

in case of R Pi, define RASPBERRY_PI then LightIndicator init() and
lit() are available.
and it should be linked with wiredPi.

if RASPBERRY_PI is not defined init(), lit() are null functions.

linux.cpp line 173 in class LightIndicator

codes are :

private:
void init()
{
#ifdef RASPBERRY_PI
if(wiringPiSetup() != -1)
{
pinMode(LIGHT_INDICATOR_GREEN, OUTPUT);
pinMode(LIGHT_INDICATOR_RED, OUTPUT);
pinMode(LIGHT_INDICATOR_BLUE, OUTPUT);
_gpioAvailable = true;
}
#endif
}

void lit(int gpioNo, int onoff)
{

#ifdef RASPBERRY_PI
if(_gpioAvailable)
{
digitalWrite(gpioNo,onoff);
}
#endif
}

Eclipse is running on Ubuntu 14.04. of ThinkPad X1 Carbon, not R. Pi.

The gateway is using 3 libraries. pthread, ssl *and crypto*.

Eclipse CDT link message is

Building target: MQTTSN-embedded-C
Invoking: GCC C++ Linker
g++ -o "MQTTSN-embedded-C" ./MQTTSNPacket/src/MQTTSNConnectClient.o
./MQTTSNPacket/src/MQTTSNConnectServer.o
./MQTTSNPacket/src/MQTTSNDeserializePublish.o
./MQTTSNPacket/src/MQTTSNPacket.o ./MQTTSNPacket/src/MQTTSNSearchClient.o
./MQTTSNPacket/src/MQTTSNSearchServer.o
./MQTTSNPacket/src/MQTTSNSerializePublish.o
./MQTTSNPacket/src/MQTTSNSubscribeClient.o
./MQTTSNPacket/src/MQTTSNSubscribeServer.o
./MQTTSNPacket/src/MQTTSNUnsubscribeClient.o
./MQTTSNPacket/src/MQTTSNUnsubscribeServer.o
./MQTTSNGateway/src/linux/udp/SensorNetwork.o
./MQTTSNGateway/src/linux/Network.o ./MQTTSNGateway/src/linux/Threading.o
./MQTTSNGateway/src/linux/linux.o
./MQTTSNGateway/src/MQTTGWConnectionHandler.o
./MQTTSNGateway/src/MQTTGWPacket.o
./MQTTSNGateway/src/MQTTGWPublishHandler.o
./MQTTSNGateway/src/MQTTGWSubscribeHandler.o
./MQTTSNGateway/src/MQTTSNGWBrokerRecvTask.o
./MQTTSNGateway/src/MQTTSNGWBrokerSendTask.o
./MQTTSNGateway/src/MQTTSNGWClient.o
./MQTTSNGateway/src/MQTTSNGWClientRecvTask.o
./MQTTSNGateway/src/MQTTSNGWClientSendTask.o
./MQTTSNGateway/src/MQTTSNGWConnectionHandler.o
./MQTTSNGateway/src/MQTTSNGWLogmonitor.o
./MQTTSNGateway/src/MQTTSNGWPacket.o
./MQTTSNGateway/src/MQTTSNGWPacketHandleTask.o
./MQTTSNGateway/src/MQTTSNGWProcess.o
./MQTTSNGateway/src/MQTTSNGWPublishHandler.o
./MQTTSNGateway/src/MQTTSNGWSubscribeHandler.o
./MQTTSNGateway/src/MQTTSNGateway.o ./MQTTSNGateway/src/mainGateway.o
./MQTTSNClient/src/linux/linux.o * -lpthread -lssl -lcrypto*
Finished building target: MQTTSN-embedded-C

BTW, LightIndicator indicates the gateway status. (only for the Raspberry
Pi and useful)

Red light means Gateway is running but no client connects.
Green one means at least one clients connects to the Broker.
Blue one means TCP/IP data is sending or receiving.

tomoaki

2016-05-24 18:42 GMT+09:00 Ian Craggs notifications@github.com:

Thanks Tomoaki.

One of the reviewers has observed that the code is using wiringPi. This
wouldn't work on every Linux, so I imagine we could have it in a Raspberry
Pi specific sample? Are there any other external libraries that are used? I
have to note each library in the contribution documents.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#10 (comment)

@ty4tw

This comment has been minimized.

Copy link
Contributor Author

ty4tw commented May 24, 2016

Hi Ian,

I checked the license. wiringPi's license is GNU LGPLv3.
if we have license problem, we can delete this portion or
I will write same functions, wiringPiSetup(), pinMode() and digitalWrite() by my self later.

tomoaki

@ty4tw

This comment has been minimized.

Copy link
Contributor Author

ty4tw commented Jun 1, 2016

Hi Ian,

I have changed the LightIndicator class does not use wiringPi.
also added a new sensor network XBee and Makefile.

tomoaki

@icraggs

This comment has been minimized.

Copy link
Contributor

icraggs commented Jun 2, 2016

Hi Tomoaki,

thanks for this. Just to let you know that we are in the final stages of releasing Paho 1.2, so we and the legal team are quite busy at the moment which is why the review process will be slower than normal.

ty4tw added some commits May 13, 2016

First Commit of MQTT-SN Gateway
Add    new SensorNetwork XBee
Add    a sensor network type in a start message.
Update MQTTSNClient to avoid build warning.
Update WiringPi's functions to my original ones. 
BugFix check msgId before adding waitdTopicId table.
BugFix Process termination procedures
Update print curent time in millseconds.
update move currentDateTime() to linux directory.
Bugfix: blink blue lightiIndicator.
Bugfix: Register returns wrong id.
change a status of the client to Disconnected.
change client status procedure
Update README
BugFix: change Network Disconnect procedures.

Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
@icraggs

This comment has been minimized.

Copy link
Contributor

icraggs commented Jun 19, 2016

The contribution has been approved, so I will merge it soon.

@icraggs icraggs merged commit 0478c6e into eclipse:gateway Jun 23, 2016

1 check passed

ip-validation
Details
@ty4tw

This comment has been minimized.

Copy link
Contributor Author

ty4tw commented Jun 23, 2016

Hi Ian,

Thanks.

Hi All,

see https://github.com/ty4tw/paho.mqtt-sn.embedded-c/wiki to build the
gateway.

Tomy Technology
Tomoaki YAMAGUCHI

2016-06-23 9:06 GMT+09:00 Ian Craggs notifications@github.com:

Merged #10 #10.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AHd9BBV_vp5oG9eQBFoEgiMCx2aMrcn3ks5qOc3-gaJpZM4Id4tq
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.