Prototype Minster Music Software

This Forum is for discussion about the development of the software to control the playing of the music in the Minster Nave and the bells in the Tower.

There will be two programs; both based on the original software but now running on two Pis.
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

TerryJC wrote: 26/01/2021, 11:37I have tested that the latter functionality still works...
I spoke too soon. The message from the Music Pi to the Bells Pi to trigger the Wedding changes no longer works. I can't see what's wrong at the moment but the two devices seem to connect OK.

I think I'm getting the naming wrong again.
Terry
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

OK. I've sussed the problem with the message passing; I changed the message checking at the Bells Pi end from a local loop inside the function that starts the Wedding Changes, to a new function to check all incoming message. This was meant to be a global call triggered by apscheduler but I forgot to add the entry in the schedule....

So this morning I've been adding all the message parsing to support the commands generated by the Webserver Control page and also the initialisation code for the extra sockets.

Hamish,

When you have time, could you check the following code snippet against the updated config.py that I pushed yesterday? My concern is how the different sockets are defined. Will this work when I get the Webserver sockets server implemented do you think? (The Webserver connection is commented out as you can see.)

Code: Select all

    # Set up connection to the Bells Pi
    site_settings = config.SITE_SETTINGS["BELLS"]

    # We are a server to the Bells Pi and we are hosting sockets.
    bells_socket = socket_tools.Sockets("Socket", "MUSIC-S", "Bells Pi Sockets Client")
    bells_socket.set_portnumber(site_settings["ServerPort"])
    bells_socket.set_server_address(site_settings["IPAddress"])
    sockets[site_settings["SocketID"]] = bells_socket

    bells_socket.start_handler()

    # Accept connection to Webserver
#    site_settings = config.SITE_SETTINGS["MUSIC-C"]

#    logger.info("Initialising connection to Webserver sockets server, please wait...")
#    print("Initialising connection to Webserver sockets server, please wait...")
#    webserver_socket = socket_tools.Sockets("Plug", "MUSIC-C", config.SITE_SETTINGS["MUSIC-C"]["SocketName"])
#    webserver_socket.set_portnumber(config.SITE_SETTINGS["MUSIC-C"]["ServerPort"])
#    webserver_socket.set_server_address(config.SITE_SETTINGS["MUSIC-C"]["ServerAddress"])

#    webserver_socket.start_handler()
As you can see, I have changed the global variable 'socket' to 'bells_socket'. This allows me to write messages to the Bells Pi by using:

Code: Select all

bells_socket.write("Wedding Changes Start")
and similarly read messages from the Bells Pi by using:

Code: Select all

data = bells_socket.read()
Is that going to work if I do the same thing for the Webserver when I take the comments out?
Terry
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

Hamish,

I could really do with a bit of help now. I have a working Music Player, Bells Player and Webserver, apart from the sockets connection between the Webserver (as a sockets server) and the Music Player (as a sockets client). Connections between the Music Player (as a sockets server) and the Bells Player (as a sockets client) are working perfectly.

I have pushed the latest code to GitLab and I have attached two files which contain the console output when the two programs are trying to connect.

(The first time I ran this, I got a Minster_Webserver.log file, but it seems to have stopped doing that, so I've copied the console output instead.)

Could you have a look at see what's going on?
Attachments
Webserver_Console.txt
(1019 Bytes) Downloaded 64 times
Music_Log.txt
(999 Bytes) Downloaded 64 times
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

NB: Doesn't look like the bells pi part of the software is in the repo, or I've missed it.

I don't think I'll need it anyway, so I'll keep investigating
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

I don't know what happened there! I must have accidentally deleted it from my local repository just before I pushed everything yesterday.

I've just recovered it from the Pi and pushed it up.
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

No matter. Just uploading my test branch so I can do a pull request in a minute.

Also of note: if this is to be accessed from the WMT guest network, don't the IPs need to be in the 192.168.0.x range, instead of 192.168.10.x?
Hamish
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

Okay, merge request submitted at https://gitlab.com/wmtprojectsteam/mins ... requests/1

You can test locally before merging with:

Code: Select all

git fetch
git checkout fix_socketsconfig
I'm not sure exactly what the problem was, but I don't seem to be having it now, though I didn't run the BELLS code. I can confirm that the old code on master doesn't work for me though, even when I adjust the IPs to 127.0.0.1.
Hamish
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

Hamish,

There are two networks. The Minster Music Pi is connected to the WMT Network via its Ethernet connector and will have the IP Address 192.168.0.50 (it is currently allocated an address on y internal network). The Minster Music Pi is then connected to the Minster Bells Pi using the USB network that I described earlier. This means that I don't need a Network Switch in the Equipment Box because the Music Pi is acting as a Router. However, the second network has to be on a different subnet and the Bells Pi can only be accessed via the Music Pi.
Terry
TerryJC
Posts: 2616
Joined: 16/05/2017, 17:17

Re: Prototype Minster Music Software

Post by TerryJC »

hamishmb wrote: 03/02/2021, 10:34Okay, merge request submitted at https://gitlab.com/wmtprojectsteam/mins ... requests/1
Hamish,

I'm extremely confused. How did fixing a whites pace error in the logging of the software version fix a sockets error?
Terry
hamishmb
Posts: 1891
Joined: 16/05/2017, 16:41

Re: Prototype Minster Music Software

Post by hamishmb »

Ah I see, that makes sense.

There are a bunch of commits (5). If you head over to the commits tab on that page (https://gitlab.com/wmtprojectsteam/mins ... /1/commits) you should be able to see each one.
Hamish
Post Reply