public void Initialize() { bool goodToGo = false; try { goodToGo = InitializeNetwork(); } catch (Exception e) { Debug.Print(e.Message); } if (goodToGo) { Debug.Print("Network done."); //Setup local time of the card Utility.SetLocalTime(NTPTime(NTP_POOL_URL, NTP_OFFSET)); Debug.Print("Local time was set. Current local time is " + DateTime.Now); //Setup initial time variables MachineRunningSince = DateTime.Now; MachineState = CoffeeMachineState.Standby; TurnOffMode = TurnOffMode.Automatic; // start web server MapleServer server = new MapleServer(); server.Start(); } }
public void Run() { this.IsRunning = true; bool goodToGo = false; try { goodToGo = InitializeNetwork(); } catch (Exception e) { Debug.Print(e.Message); } if (goodToGo) { MakeWebRequest("http://google.com"); // Debug.Print("Network done."); // set initial state Ports.ONBOARD_LED.Write(false); Ports.GPIO_PIN_D1.Write(false); // start web server MapleServer server = new MapleServer(); server.Start(); } //this.IsRunning = false; }
private void InitializerNetworkConnected(object sender, EventArgs e) { Debug.Print("InitializeNetwork()"); _server.Start("ServoHost", Initializer.CurrentNetworkInterface.IPAddress); _servoController.RotateTo(0); }
private void InitializerNetworkConnected(object sender, EventArgs e) { _playerTeamA.NetworkConnected(); _playerTeamB.NetworkConnected(); _server.Start("SoccerHost01", Initializer.CurrentNetworkInterface.IPAddress); }
async Task Initialize() { Console.WriteLine("Initialize hardware..."); onboardLed = new RgbPwmLed(device: Device, redPwmPin: Device.Pins.OnboardLedRed, greenPwmPin: Device.Pins.OnboardLedGreen, bluePwmPin: Device.Pins.OnboardLedBlue, 3.3f, 3.3f, 3.3f); onboardLed.SetColor(Color.Red); // initialize the wifi adpater if (!Device.InitWiFiAdapter().Result) { throw new Exception("Could not initialize the WiFi adapter."); } // connnect to the wifi network. Console.WriteLine($"Connecting to WiFi Network {Secrets.WIFI_NAME}"); var connectionResult = await Device.WiFiAdapter.Connect(Secrets.WIFI_NAME, Secrets.WIFI_PASSWORD); if (connectionResult.ConnectionStatus != ConnectionStatus.Success) { throw new Exception($"Cannot connect to network: {connectionResult.ConnectionStatus}"); } Console.WriteLine($"Connected. IP: {Device.WiFiAdapter.IpAddress}"); // create our maple web server mapleServer = new MapleServer(Device.WiFiAdapter.IpAddress, 5417, true); mapleServer.Start(); onboardLed.SetColor(Color.Green); }
public MeadowApp() { //Thread.Sleep(5000); Initialize().Wait(); server.Start(); }
private static void Initializer_NetworkConnected(object sender, EventArgs e) { var mapleServer = new MapleServer(); mapleServer.Start(); Debug.Print("Maple started"); }
private void OnNetworkConnected(object sender, EventArgs e) { _timerCallback = new TimerCallback(OnTimerInterrupt); _timer = new Timer(_timerCallback, null, TimeSpan.FromTicks(0), new TimeSpan(0, 30, 0)); _server.Start("PlantHost", Initializer.CurrentNetworkInterface.IPAddress); _rgbPwmLed.SetColor(Netduino.Foundation.Color.Green); }
public MeadowApp() { Initialize().Wait(); mapleServer.Start(); LedController.Current.SetColor(Color.Green); }
void OnNetworkConnected(object sender, EventArgs e) { Debug.Print("InitializeNetwork()"); mapleServer.Start("CarHost", Initializer.CurrentNetworkInterface.IPAddress); ledRed.Stop(); ledGreen.IsOn = true; tankController.Stop(); }
public MeadowApp() { // initialize our hardware and system Initialize().Wait(); // start our web server mapleServer.Start(); // display a default message displayController.ShowText("READY"); }
public void Run() { bool networkInit = Initializer.InitializeNetwork("http://google.com"); if (networkInit) { _menu.UpdateItemValue("IP", Initializer.CurrentNetworkInterface.IPAddress.ToString()); _server.Start(); Debug.Print("Maple server started."); } }
public void Run() { Initializer.NetworkConnected += (s, e) => { _menu.UpdateItemValue("IP", Initializer.CurrentNetworkInterface.IPAddress.ToString()); _server.Start("dehydrator3000", Initializer.CurrentNetworkInterface.IPAddress.ToString()); Debug.Print("Maple server started."); }; Initializer.InitializeNetwork("http://google.com"); }
public static void Main() { MapleServer server = new MapleServer(); Initializer.NetworkConnected += (s, e) => { // start maple server and send name broadcast address server.Start("assimilate server", Initializer.CurrentNetworkInterface.IPAddress); }; Initializer.InitializeNetwork(); Thread.Sleep(Timeout.Infinite); }
void OnNetworkConnected(object sender, EventArgs e) { timerCallback = new TimerCallback(OnTimerInterrupt); timer = new Timer(timerCallback, null, TimeSpan.FromTicks(0), new TimeSpan(1, 0, 0)); mapleServer.Start("PlantHost", Initializer.CurrentNetworkInterface.IPAddress); displayController.Clear(true); displayController.DrawText("Connected!"); Thread.Sleep(1000); rgbPwmLed.SetColor(Netduino.Foundation.Color.Green); }
public void Run() { Initializer.InitializeNetwork(); Debug.Print("InitializeNetwork()"); while (Initializer.CurrentNetworkInterface == null) { } _server.Start("RgbLedHost", Initializer.CurrentNetworkInterface.IPAddress); _rgbController.NetworkConnected(); }
public static void Main() { // TODO: can't seem to get this example to work regardless of using directives/references - so going w/ this hack for now! //while (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()) while (Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress == "0.0.0.0") { Debug.Print("Waiting for network..."); Thread.Sleep(10); } ; Debug.Print("IP: " + Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress); remoteController = new DS1803Controller(); var handler = new RequestHandler(); // TODO: sweepPot(byte pot, int from, int to) //handler.SweepPot += (s, e) => { remoteController.sweepPot(); }; handler.SweepSteeringPotCenterToRight += (s, e) => { remoteController.sweepSteeringPotCenterToRight(); }; handler.SweepSteeringPotCenterToLeft += (s, e) => { remoteController.sweepSteeringPotCenterToLeft(); }; handler.SweepSteeringPotRightToLeft += (s, e) => { remoteController.sweepSteeringPotRightToLeft(); }; handler.SweepSteeringPotLeftToRight += (s, e) => { remoteController.sweepSteeringPotLeftToRight(); }; handler.SweepSteeringPotRightToCenter += (s, e) => { remoteController.sweepSteeringPotRightToCenter(); }; handler.SweepSteeringPotLeftToCenter += (s, e) => { remoteController.sweepSteeringPotLeftToCenter(); }; handler.SweepSteeringPotTest += (s, e) => { remoteController.sweepSteeringPotTest(); }; handler.SweepThrottlePotCenterToMaxForward += (s, e) => { remoteController.sweepThrottlePotCenterToMaxForward(); }; handler.SweepThrottlePotMaxForwardToCenter += (s, e) => { remoteController.sweepThrottlePotMaxForwardToCenter(); }; handler.SweepThrottlePotCenterToMaxReverse += (s, e) => { remoteController.sweepThrottlePotCenterToMaxReverse(); }; handler.SweepThrottlePotMaxReverseToCenter += (s, e) => { remoteController.sweepThrottlePotMaxReverseToCenter(); }; handler.SweepThrottlePotCenterToMidForward += (s, e) => { remoteController.sweepThrottlePotCenterToMidForward(); }; handler.SweepThrottlePotMidForwardToCenter += (s, e) => { remoteController.sweepThrottlePotMidForwardToCenter(); }; handler.SweepThrottlePotCenterToMidReverse += (s, e) => { remoteController.sweepThrottlePotCenterToMidReverse(); }; handler.SweepThrottlePotMidReverseToCenter += (s, e) => { remoteController.sweepThrottlePotMidReverseToCenter(); }; handler.CircleRight += (s, e) => { remoteController.circleRight(); }; handler.CircleLeft += (s, e) => { remoteController.circleLeft(); }; handler.Stop += (s, e) => { remoteController.stop(); }; maple = new MapleServer(); maple.AddHandler(handler); maple.Start(); Debug.Print("Maple serving on http://" + Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress); }
public static void Main(string[] args) { MapleServer server = new MapleServer( IPAddress.Parse("127.0.0.1"), // OR: //GetLocalIP(), advertise: true, processMode: RequestProcessMode.Parallel ); server.Start(); Console.WriteLine($"Server is listening on {server.IPAddress}"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); server.Stop(); Console.WriteLine("Goodbye."); }
/// <summary> /// Get the app running /// </summary> internal void Run() { bool isConnected = false; try { // attempt to connect isConnected = InitNetwork(); } catch (Exception ex) { Debug.Print(ex.Message); } // if it is connected, take the other initialize actions if (isConnected) { // start REST API server MapleServer server = new MapleServer(); server.AddHandler(new RequestHandler()); server.Start(ServerName, Initializer.CurrentNetworkInterface.IPAddress); } }
public MeadowApp() { Initialize().Wait(); mapleServer.Start(); }
public MeadowApp() { InitializeAsync().Wait(); server.Start(); ServoController.Instance.SetAngle(0); }
private static void InitializeHttpJsonServer() { var server = new MapleServer(); server.Start(); }