-
Notifications
You must be signed in to change notification settings - Fork 11
/
SimpleConsole.h
51 lines (37 loc) · 1.57 KB
/
SimpleConsole.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
#include "WlanHostedNetworkWinRT.h"
/// A simple console helper to take commands and start the "soft AP"
class SimpleConsole : public IWlanHostedNetworkListener, public IWlanHostedNetworkPrompt
{
public:
SimpleConsole();
virtual ~SimpleConsole();
void RunConsole();
// IWlanHostedNetworkListener Implementation
virtual void OnDeviceConnected(std::wstring remoteHostName) override;
virtual void OnDeviceDisconnected(std::wstring deviceId) override;
virtual void OnAdvertisementStarted() override;
virtual void OnAdvertisementStopped(std::wstring message) override;
virtual void OnAdvertisementAborted(std::wstring message) override;
virtual void OnAsyncException(std::wstring message) override;
virtual void LogMessage(std::wstring message) override;
// IWlanHostedNetworkPrompt Implementation
virtual bool AcceptIncommingConnection() override;
private:
void ShowPrompt();
void ShowHelp();
bool ExecuteCommand(std::wstring command);
WlanHostedNetworkHelper _hostedNetwork;
// Event helper to wait on async operations in console
Microsoft::WRL::Wrappers::Event _apEvent;
};