Upcoming Games


Full list
Add a game

Who's Online

Chromatix, hotwellian, JamesN, Klo653, Soton_Speed (5 users seen recently)

Interface Gateway Help Requested

You are here: Home > Forum > General > General questions, comments, and issues > Interface Gateway Help Requested

Page 1 of 1

Interface Gateway Broken 06/10/2018 at 20:04 #112492
SamTDS
Avatar
84 posts
Hey. Reading through the wiki I came across the interface gateway and had a look. It was intresting seeing the posibility of recieving the data feed. I looked in the example at the other pieces in the repository and found out that you are able to send commands to control sections of the sim itself, thus proving a great potential project to make a mock up signal board controling the sim through the stomp client. Today i have tried to go with the basic reading the data feed and i have encountered numerous random errors. The program fails to connect with the correct ports and ip set however simsig is throwing an error saying access violation.
SamTDS - STDS
Log in to reply
Interface Gateway Broken 06/10/2018 at 20:09 #112493
headshot119
Avatar
3046 posts
I'd be tempted to say it's more an issue with the code you are using to connect, than with the interface gateway itself.

It worked fine the last time I used it.

"James Street, Moorfields, Liverpool Lime Street and Liverpool Central" - Opinions are my own and not those of my employer
Log in to reply
Interface Gateway Broken 06/10/2018 at 20:14 #112494
SamTDS
Avatar
84 posts
i am using latest stomp.py version installed through pip and running your script through cmd. i also tried running stomp.py directly in the command line interface with same problem. copy of code as attached
Post has attachments. Log in to view them.
SamTDS - STDS
Log in to reply
Interface Gateway Broken 06/10/2018 at 20:16 #112495
headshot119
Avatar
3046 posts
I'm not in a position to do any debugging of code for a few days.

My client however is working fine, though it's written in Java not Python.

I'll have a look when I can.

"James Street, Moorfields, Liverpool Lime Street and Liverpool Central" - Opinions are my own and not those of my employer
Log in to reply
The following user said thank you: SamTDS
Interface Gateway Broken 06/10/2018 at 20:21 #112496
SamTDS
Avatar
84 posts
roger, thanks in advance. It would probably be a good idea to learn java and get using your current client and work from there.
SamTDS - STDS
Log in to reply
Interface Gateway Broken 06/10/2018 at 20:28 #112497
GeoffM
Avatar
4277 posts
I'm not familiar with Python I'm afraid. It hasn't changed for quite a while and as Karl says it works on test clients. Granted SimSig should not throw an access violation so I'd be interested to work out how that is being generated.
SimSig Boss. Website issues: Check here first: https://www.simsig.co.uk/Wiki/Show?page=newwebsite
Log in to reply
Interface Gateway Broken 06/10/2018 at 20:55 #112498
SamTDS
Avatar
84 posts
GeoffM in post 112497 said:
I'm not familiar with Python I'm afraid. It hasn't changed for quite a while and as Karl says it works on test clients. Granted SimSig should not throw an access violation so I'd be interested to work out how that is being generated.
here is an image of the error message in full. i was trying brigton earlier and this is the same with roysten now


Post has attachments. Log in to view them.
SamTDS - STDS
Log in to reply
Interface Gateway Broken 06/10/2018 at 23:11 #112499
headshot119
Avatar
3046 posts
Right...

So I've just got home and run your script on my PC, and it just works out of the box on Aston, North Wales Coast, and Brighton.

I would suggest it's an issue with whichever stomp library you have downloaded.

"James Street, Moorfields, Liverpool Lime Street and Liverpool Central" - Opinions are my own and not those of my employer
Log in to reply
Interface Gateway Broken 06/10/2018 at 23:33 #112500
SamTDS
Avatar
84 posts
hmm, most likely my python install is throroughly screwed. as for where i got the libray i had went directly from the link in the readme which was https://pypi.org/project/stomp.py/ and ran the install command provided. What could possibly be happening is you may have an older version of the library which may behave differently and be called differently. doing the command python -m stomp --version gives me the version number 4.1.21

Its almost midnight here so il probably experiment a bit tomorrow at trying to get it to work.

SamTDS - STDS
Log in to reply
Interface Gateway Broken 07/10/2018 at 07:07 #112505
GeoffM
Avatar
4277 posts
Again, I'm a bit rusty on this but the "Expecting CONNECT" message is because SimSig is not seeing the verb "CONNECT" with the key/value of "accept-version" and "1.1". Yet the Python code (which I'm not familiar with) appears to send that, and Karl says it works. So I'm confused. The only thing that stands out for me is the body='accept-version:1.1' which reads to me as the body, not the header text.

As if it's sending:
CONNECT

otherbodytext
accept-version:1.1
^@

Instead of:
CONNECT
accept-version:1.1

otherbodytext
^@

(the double carriage return signifies the end of headers and the start of the body)

Maybe it's as simple as:
conn.start()
conn.connect()
conn.subscribe(etc)

(from https://stackoverflow.com/questions/6234630/activemq-how-to-configure-to-work-with-stomp-in-python )

SimSig Boss. Website issues: Check here first: https://www.simsig.co.uk/Wiki/Show?page=newwebsite
Last edited: 07/10/2018 at 07:16 by GeoffM
Reason: None given

Log in to reply
Interface Gateway Broken 07/10/2018 at 13:50 #112513
SamTDS
Avatar
84 posts
GeoffM in post 112505 said:
Again, I'm a bit rusty on this but the "Expecting CONNECT" message is because SimSig is not seeing the verb "CONNECT" with the key/value of "accept-version" and "1.1". Yet the Python code (which I'm not familiar with) appears to send that, and Karl says it works. So I'm confused. The only thing that stands out for me is the body='accept-version:1.1' which reads to me as the body, not the header text.

As if it's sending:
CONNECT

otherbodytext
accept-version:1.1
^@

Instead of:
CONNECT
accept-version:1.1

otherbodytext
^@

(the double carriage return signifies the end of headers and the start of the body)

Maybe it's as simple as:
conn.start()
conn.connect()
conn.subscribe(etc)

(from https://stackoverflow.com/questions/6234630/activemq-how-to-configure-to-work-with-stomp-in-python )
probably is what you say at the end. il do some testing from scratch and get back to you how it goes. Il also do a clean install of python and start from there

SamTDS - STDS
Last edited: 07/10/2018 at 13:54 by SamTDS
Reason: None given

Log in to reply
Interface Gateway Broken 07/10/2018 at 15:32 #112514
SamTDS
Avatar
84 posts
I have no idea what is going on, im attempting to watch the traffic in order to find out what's happening. I dont know the protocol to that depth as much but i think im doing all the right commands but the library isnt sending the verb connect which simsig is wanting. It sends everything else but not CONNECT. As attached is the exact code i ran in the python shell and the localhost network traffic pcap file. Wireshark is able to open it up fine and can see where each try is by the grey space. For now i am going to wait and try to figure it out later trying different libraries and languages monitoring what they give on wireshark.
Post has attachments. Log in to view them.
SamTDS - STDS
Log in to reply
Interface Gateway Broken 07/10/2018 at 17:50 #112518
Zoe
Avatar
238 posts
It looks like your client is sending a STOMP frame (introduced in STOMP 1.1) rather than a CONNECT frame. I have just tried connecting to a sim using a STOMP frame and get the "Expecting CONNECT frame" error so it seems that this is not supported by SimSig.
Last edited: 07/10/2018 at 17:53 by Zoe
Reason: None given

Log in to reply
Interface Gateway Broken 07/10/2018 at 18:44 #112520
SamTDS
Avatar
84 posts
its likely we have a later version of the library than others. We will have to wait for headshot119 to see if that is the case. If we know the working version number then we can install the older versions
SamTDS - STDS
Log in to reply
Interface Gateway Broken 07/10/2018 at 19:12 #112522
Zoe
Avatar
238 posts
SamTDS in post 112520 said:
its likely we have a later version of the library than others. We will have to wait for headshot119 to see if that is the case. If we know the working version number then we can install the older versions

I'm not using any library, I just tried sending a STOMP frame using netcat and this resulted in the "Expecting CONNECT frame" error, suggesting that SimSig does not support STOMP frames (the STOMP 1.1 specification only says that servers SHOULD handle a STOMP frame in the same was as a CONNECT frame, it does not say that they MUST do so). Sending a CONNECT frame works fine.

Last edited: 07/10/2018 at 19:17 by Zoe
Reason: None given

Log in to reply
Interface Gateway Help Requested 13/10/2018 at 22:22 #112612
belly buster
Avatar
318 posts
Likewise I tried it using both python 2.7 and 3.7 venvs and I got the same access violation and no response from the gateway.
Log in to reply
Interface Gateway Help Requested 14/10/2018 at 19:02 #112626
SamTDS
Avatar
84 posts
belly buster in post 112612 said:
Likewise I tried it using both python 2.7 and 3.7 venvs and I got the same access violation and no response from the gateway.
using the stompest library instead i am able to conenct and recive just trying to parse it now. this library has 1 problem with the subscribe command not including ID but i send a manual frame to solve that.

Will keep updated on how it goes and get a working version for everyone

edit: added screenshot of my current output result

http://prntscr.com/l60b2q

Post has attachments. Log in to view them.
SamTDS - STDS
Last edited: 14/10/2018 at 19:10 by SamTDS
Reason: None given

Log in to reply
Interface Gateway Help Requested 14/10/2018 at 20:04 #112629
SamTDS
Avatar
84 posts
Quote:
from stompest.config import StompConfig
from stompest.protocol import StompSpec, frame
from stompest.sync import Stomp

CONFIG = StompConfig('tcp://localhost:51515', version=StompSpec.VERSION_1_1)
QUEUE = '/topic/TD_ALL_SIG_AREA'

if __name__ == '__main__':
client = Stomp(CONFIG)
client.connect()
# client.subscribe(QUEUE, {StompSpec.ACK_HEADER: StompSpec.ACK_CLIENT_INDIVIDUAL})
a = frame.StompFrame(command='SUBSCRIBE', rawHeaders=[('id', '0'), ('destination', '/topic/TD_ALL_SIG_AREA'),('ack', 'auto')])
client.sendFrame(a)
while True:
frame = client.receiveFrame()
print(dict(frame))
client.disconnect()
That is the working code giving the raw messages out, il work on making it more readable in the next couple of days. For the library to get it all you have to do is
Quote:
pip install stompest
in the command line. The erroneous subscribe command has been left in hashed out as it does not include the needed id field that the 1.1 version requires.

SamTDS - STDS
Last edited: 14/10/2018 at 20:04 by SamTDS
Reason: None given

Log in to reply
Interface Gateway Help Requested 31/01/2019 at 18:35 #115234
SamTDS
Avatar
84 posts
Its been a while since work on this has been done due to cost to produce a full panel for even Royston. Tonight I have had the idea of instead of doing every signal and berth, do just the approach and last sent berths alongside the slot flags. This way looking at the physical panel will give a quick idea of what's approaching and slot statuses. This means a panel could be done for under £50. Id love to hear what you think. If I can find a pcb design software that works well then I might even be able to have a prototype of Royston at the Birmingham meet.
SamTDS - STDS
Log in to reply
The following user said thank you: ajax103
Interface Gateway Help Requested 18/02/2019 at 16:50 #115842
ajax103
Avatar
597 posts
That would be interesting to see as atm it does come across as rather complicated sounding so seeing it being demo would help me for one to understand the process.
Log in to reply