Skip to content
New issue

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

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

Already on GitHub? # to your account

not able to subscribe to Predefined topic #123

Closed
gualtrapa opened this issue Jul 19, 2018 · 4 comments
Closed

not able to subscribe to Predefined topic #123

gualtrapa opened this issue Jul 19, 2018 · 4 comments

Comments

@gualtrapa
Copy link

Hi!

We are trying to used "predefined topics" new feature. We enable PredefinedTopic usage on "gateway.conf" and let "predefinedTopic.conf" as the one that its provide as an example.

Then we try to subscribe using the command line using the following command

./mqtt-sn-sub -p 5223 -T 1 c -q 1 -i "GatewayTestClient"

or

./mqtt-sn-sub -p 5223 -T "1" c -q 1 -i "GatewayTestClient"

but we get an error:

ERROR SUBSCRIBE error: Rejected: not supported

The GW log shows

20180719 101437.847   CONNECT           <---  GatewayTestClient                   04 04 01 00 0A 47 61 74 65 77 61 79 54 65 73 74 43 6C 69 65 6E 74
20180719 101437.848   CONNECT           ===>  GatewayTestClient                   10 1D 00 04 4D 51 54 54 04 02 00 0A 00 11 47 61 74 65 77 61 79 54 65 73 74 43 6C 69 65 6E 74
20180719 101438.007   CONNACK           <===  GatewayTestClient                   20 02 00 00
20180719 101438.007   CONNACK           --->  GatewayTestClient                   05 00

20180719 101438.007   SUBSCRIBE   0001  <---  GatewayTestClient                   12 21 00 01 00 01
20180719 101438.008   SUBACK      0001  --->  GatewayTestClient                   13 20 00 01 00 01 03
20180719 101642.000   ADVERTISE         --->  Clients                             00 03 03 84

Any help is wellcome!

Thanks in advance

@ty4tw
Copy link
Contributor

ty4tw commented Jul 23, 2018

It works fine. Could you see the prompt,PreDefFile: ./predefinedTopic.conf ?

20180724 064027.518 PahoGateway-01 has been started.

 ConfigFile: ./gateway.conf
 SensorN/W:  UDP Multicast 225.1.1.1:1883 Gateway Port 10000
 Broker:     iot.eclipse.org : 1883, 8883
 PreDefFile: ./predefinedTopic.conf
 RootCApath: (null)
 RootCAfile: (null)
 CertKey:    (null)
 PrivateKey: (null)

20180724 064112.491   SEARCHGW          <---  Client                              01 00
20180724 064112.491   GWINFO            --->  Clients                             02 01

20180724 064112.491   CONNECT           <---  GatewayTestClient                   04 04 01 00 3C 47 61 74 65 77 61 79 54 65 73 74 43 6C 69 65 6E 74
20180724 064112.862   CONNECT           ===>  GatewayTestClient                   10 1D 00 04 4D 51 54 54 04 02 00 3C 00 11 47 61 74 65 77 61 79 54 65 73 74 43 6C 69 65 6E 74
20180724 064113.067   CONNACK           <===  GatewayTestClient                   20 02 00 00
20180724 064113.067   CONNACK           --->  GatewayTestClient                   05 00

20180724 064113.067   SUBSCRIBE   0001  <---  GatewayTestClient                   12 20 00 01 74 79 34 74 77 2F 74 6F 70 69 63 31

20180724 064113.067   SUBSCRIBE   0002  <---  GatewayTestClient                   12 20 00 02 74 79 34 74 77 2F 74 6F 70 69 63 32
20180724 064113.067   SUBSCRIBE   0001  ===>  GatewayTestClient                   82 11 00 01 00 0C 74 79 34 74 77 2F 74 6F 70 69 63 31 01
20180724 064113.067   SUBSCRIBE   0002  ===>  GatewayTestClient                   82 11 00 02 00 0C 74 79 34 74 77 2F 74 6F 70 69 63 32 01
20180724 064113.271   SUBACK      0001  <===  GatewayTestClient                   90 03 00 01 01
20180724 064113.271   SUBACK      0001  --->  GatewayTestClient                   13 20 00 01 00 01 00
20180724 064113.476   SUBACK      0002  <===  GatewayTestClient                   90 03 00 02 01
20180724 064113.476   SUBACK      0002  --->  GatewayTestClient                   13 20 00 02 00 02 00

20180724 064118.741   SUBSCRIBE   0003  <---  GatewayTestClient                   12 21 00 03 00 01
20180724 064118.741   SUBSCRIBE   0003  ===>  GatewayTestClient                   82 1B 00 03 00 16 74 79 34 74 77 2F 70 72 65 64 65 66 69 6E 65 64 54 6F 70 69 63 31 01
20180724 064119.006   SUBACK      0003  <===  GatewayTestClient                   90 03 00 03 01
20180724 064119.006   SUBACK      0003  --->  GatewayTestClient                   13 20 00 01 00 03 00**

ty4tw added a commit that referenced this issue Jul 23, 2018
Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
@ty4tw
Copy link
Contributor

ty4tw commented Jul 23, 2018

Thank you for your information.
pre-defined-topic file name setting was incorrect.
I think that this is the cause.

@ty4tw ty4tw closed this as completed Jul 27, 2018
@gualtrapa
Copy link
Author

Sorry for my delayed answer, but I was on vacations.

We are testing last GW version we just downloaded.

When we start the GW we see the prompt:

 ***************************************************************************
 * MQTT-SN Transparent Gateway
 * Part of Project Paho in Eclipse
 * (http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt-sn.embedded-c.git/)
 *
 * Author : Tomoaki YAMAGUCHI
 * Version: 1.2.0
 ***************************************************************************

20180730 095101.973 PahoGateway-PredefinedTopics has been started.

 ConfigFile: ./gateway.conf
 PreDefFile: ./predefinedTopic.conf
 SensorN/W:  UDP Multicast 225.1.1.1:5221 Gateway Port 5223
 Broker:     192.168.20.16 : 5221, 5222
 RootCApath: (null)
 RootCAfile: (null)
 CertKey:    (null)
 PrivateKey: (null)

We try to subscribe predefined topic 1:

./mqtt-sn-sub -p 5223 -T 1 -c -q 1 -i "GatewayTestClient"

And all works as expected, but if we disconect from de GW and try to subscribe again we get the error

2018-07-30 09:55:53 ERROR SUBSCRIBE error: Rejected: not supported

The GW log shows:

 ***************************************************************************
 * MQTT-SN Transparent Gateway
 * Part of Project Paho in Eclipse
 * (http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt-sn.embedded-c.git/)
 *
 * Author : Tomoaki YAMAGUCHI
 * Version: 1.2.0
 ***************************************************************************

20180730 095101.973 PahoGateway-PredefinedTopics has been started.

 ConfigFile: ./gateway.conf
 PreDefFile: ./predefinedTopic.conf
 SensorN/W:  UDP Multicast 225.1.1.1:5221 Gateway Port 5223
 Broker:     192.168.20.16 : 5221, 5222
 RootCApath: (null)
 RootCAfile: (null)
 CertKey:    (null)
 PrivateKey: (null)

20180730 095457.767   CONNECT           <---  GatewayTestClient                   04 00 01 00 0A 47 61 74 65 77 61 79 54 65 73 74 43 6C 69 65 6E 74
20180730 095457.768   CONNECT           ===>  GatewayTestClient                   10 1D 00 04 4D 51 54 54 04 00 00 0A 00 11 47 61 74 65 77 61 79 54 65 73 74 43 6C 69 65 6E 74
20180730 095458.020   CONNACK           <===  GatewayTestClient                   20 02 01 00
20180730 095458.020   CONNACK           --->  GatewayTestClient                   05 00

20180730 095458.021   SUBSCRIBE   0001  <---  GatewayTestClient                   12 21 00 01 00 01
20180730 095458.021   SUBSCRIBE   0001  ===>  GatewayTestClient                   82 1B 00 01 00 16 74 79 34 74 77 2F 70 72 65 64 65 66 69 6E 65 64 54 6F 70 69 63 31 01
20180730 095458.022   SUBACK      0001  <===  GatewayTestClient                   90 03 00 01 01
20180730 095458.022   SUBACK      0001  --->  GatewayTestClient                   13 20 00 01 00 01 00

20180730 095508.032   PINGREQ           <---  GatewayTestClient                   16
20180730 095508.033   PINGREQ           ===>  GatewayTestClient                   C0 00
20180730 095508.033   PINGRESP          <===  GatewayTestClient                   D0 00
20180730 095508.033   PINGRESP          --->  GatewayTestClient                   17

20180730 095518.044   PINGREQ           <---  GatewayTestClient                   16
20180730 095518.044   PINGREQ           ===>  GatewayTestClient                   C0 00
20180730 095518.045   PINGRESP          <===  GatewayTestClient                   D0 00
20180730 095518.045   PINGRESP          --->  GatewayTestClient                   17

20180730 095528.054   PINGREQ           <---  GatewayTestClient                   16
20180730 095528.055   PINGREQ           ===>  GatewayTestClient                   C0 00
20180730 095528.055   PINGRESP          <===  GatewayTestClient                   D0 00
20180730 095528.055   PINGRESP          --->  GatewayTestClient                   17

20180730 095538.064   PINGREQ           <---  GatewayTestClient                   16
20180730 095538.065   PINGREQ           ===>  GatewayTestClient                   C0 00
20180730 095538.065   PINGRESP          <===  GatewayTestClient                   D0 00
20180730 095538.065   PINGRESP          --->  GatewayTestClient                   17

20180730 095548.076   PINGREQ           <---  GatewayTestClient                   16
20180730 095548.076   PINGREQ           ===>  GatewayTestClient                   C0 00
20180730 095548.077   PINGRESP          <===  GatewayTestClient                   D0 00
20180730 095548.077   PINGRESP          --->  GatewayTestClient                   17
20180730 095550.305   DISCONNECT        <---  GatewayTestClient                   18
20180730 095550.306   DISCONNECT        --->  GatewayTestClient                   18
20180730 095550.306   DISCONNECT        ===>  GatewayTestClient                   E0 00

20180730 095552.967   CONNECT           <---  GatewayTestClient                   04 00 01 00 0A 47 61 74 65 77 61 79 54 65 73 74 43 6C 69 65 6E 74
20180730 095552.968   CONNECT           ===>  GatewayTestClient                   10 1D 00 04 4D 51 54 54 04 00 00 0A 00 11 47 61 74 65 77 61 79 54 65 73 74 43 6C 69 65 6E 74
20180730 095553.312   CONNACK           <===  GatewayTestClient                   20 02 01 00
20180730 095553.312   CONNACK           --->  GatewayTestClient                   05 00

20180730 095553.313   SUBSCRIBE   0001  <---  GatewayTestClient                   12 21 00 01 00 01
20180730 095553.313   SUBACK      0001  --->  GatewayTestClient                   13 20 00 01 00 01 03

If we stop the GW and relaunch it again, we can subscribe to the topic. But it only works the first time, then the error occurs.

Thanks in advance for your support.

@ty4tw ty4tw reopened this Jul 30, 2018
@ty4tw
Copy link
Contributor

ty4tw commented Jul 30, 2018

Hi,
new develop branch which has QoS-1 PUBLISH function is solved this problem. Try it.
Thanks.

@ty4tw ty4tw closed this as completed Jul 31, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants