DmxOscServer
- class DmxOscServer.DmxOscServer[source]
Instantiate a DMX OSC Server
- add_fixture(fixture)[source]
Adds a new Fixture to the fixture list
- Parameters:
fixture (Fixture) – The Fixture to add
- Raises:
TypeError – If the fixture is not a Fixture
ValueError – If the address of the fixture is already used in the universe
Example
from DmxOscServer import DmxOscServer, Fixture server = DmxOscServer() def handler(fixture, address, *args): print(fixture.values) fix = Fixture(0, 0, 3, handler) server.add_fixture(fix)
- add_fixtures(*fixtures)[source]
Adds multiple Fixtures to the fixture list
- Parameters:
*fixtures (Fixture) – The Fixtures to add
- Raises:
TypeError – If one or more of the fixtures is not a Fixture
ValueError – If the address of one or more of the fixtures is already used in the universe
Example
from DmxOscServer import DmxOscServer, Fixture server = DmxOscServer() def handler(fixture, address, *args): print(fixture.values) fix1 = Fixture(0, 0, 3, handler) fix2 = Fixture(0, 3, 3, handler) server.add_fixtures(fix1, fix2)
- define_fixture(universe, starting_addr, channels)[source]
Allows you to define a new fixture using a function decorator
- Parameters:
universe (int) – The universe for this Fixture
starting_addr (int) – The starting address for this Fixture
channels (int) – The amount of channel that this Fixture should have
- Raises:
TypeError – If the fixture is not a Fixture
ValueError – If the address of the fixture is already used in the universe
Example
from DmxOscServer import DmxOscServer, Fixture server = DmxOscServer() @server.define_fixture(0, 0, 3) def rgb_handler(fixture, address, *args): print(fixture.values)
- list_fixtures(universe=False)[source]
If universe is set to False, it will return all the Fixtures If universe is set to a universe number, it will return all the Fixtures of that universe
- Parameters:
universe (int or False) – Specifies the universe. Set to False for all Fixtures
- Returns:
List of Fixtures
- Return type:
Fixture[]
Example
from DmxOscServer import DmxOscServer server = DmxOscServer() # Add fixtures here all_fixtures = server.list_fixtures() universe_zero_fixtures = server.list_fixtures(0)
Example
from DmxOscServer import DmxOscServer
server = DmxOscServer()
@server.define_fixture(0, 0, 3) # Defines a fixture at universe 0, starting_address 0, with 3 channels
def rgb_handler(fixture, address, *args):
print ("Fixture got changed at {} to {}".format(address, args))
server.run()