Experimental/Matts Toy 2019/SallyRide/src/main/cpp/subsystems/LightingSubsystem.cpp
// Constructor, used to build a LightingSubsystem object.
Constructor, used to build a LightingSubsystem object.
Constructor used to build a LightingSubsystem object .
LightingSubsystem::LightingSubsystem()
    : Subsystem("LightingSubsystem"), udpSocket(setupUdpSocket()) {
  if (udpSocket == -1) {
    std::cerr
        << "***** Warning: Failed to allocate socket for Lighting subsystem!\n";
  } else if (!getDestinationAddress(broadcastAddress, "255.255.255.255",
                                    USE_PORT)) {
    std::cerr << "***** Warning: Failed to get broadcast address for Lighting "
                 "subsystem!\n";
    std::cerr << "               (Closing socket....)\n";
    ::close(udpSocket);
    udpSocket = -1;
  }
}
LightingSubsystem :: LightingSubsystem ( ) : Subsystem ( " " ) , udpSocket ( setupUdpSocket ( ) ) { if ( udpSocket == -1 ) { std :: cerr << " \n " ; } else if ( ! getDestinationAddress ( broadcastAddress , " " , USE_PORT ) ) { std :: cerr << " " " \n " ; std :: cerr << " \n " ; :: close ( udpSocket ) ; udpSocket = -1 ; } }
Constructor, used to build a LightingSubsystem object.
Constructor used to build a LightingSubsystem object .
// We weren't able to create/set up the socket. // If we don't know who to broadcast to, we might as well close up the // socket, since we won't be able to use it later.