public LWM2MTestClientFixture() { Assembly assembly = Assembly.GetExecutingAssembly(); System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location); Console.WriteLine(string.Concat("TestClient Version - ", fileVersionInfo.FileVersion)); CoAP.Log.LogManager.Level = CoAP.Log.LogLevel.None; Client = new Client(55863); Client.LoadDefaultResources(); Client.Start(); // TODO PSK and Certificate versions Client.UsePSK(TestConfiguration.TestData.Identity.PSK.Key, TestConfiguration.TestData.Identity.PSK.Secret); // FIXME: Should access API for bootstrap servers and PSK/Certificate Client.ConnectToServer(TestConfiguration.TestData.LWM2MClient.URI); }
public SetResourceCommand(Client client) : base() { Name = "set"; _Client = client; }
public PSKCommand(Client client) : base() { Name = "psk"; _Client = client; }
public ConnectCommand(Client client) : base() { Name = "connect"; _Client = client; }
public InstancesTests(DeviceServerClientFixture httpClientFixture, LWM2MTestClientFixture lwm2mTestClientFixture) { _HttpClientFixture = httpClientFixture; _TestClient = lwm2mTestClientFixture.Client; }
public CertificateFileCommand(Client client) : base() { Name = "cert"; _Client = client; }
public SaveCommand(Client client) : base() { Name = "save"; _Client = client; }
public FCAPCommand(Client client) : base() { Name = "fcap"; _Client = client; }
public BootstrapCommand(Client client) : base() { Name = "bootstrap"; _Client = client; }
public DisplayResourceCommand(Client client) : base() { Name = "show"; _Client = client; }
static void Main(string[] args) { Client client = null; try { Assembly assembly = Assembly.GetExecutingAssembly(); System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location); Console.WriteLine(string.Concat("TestClient Version - ", fileVersionInfo.FileVersion)); CoAP.Log.LogManager.Level = CoAP.Log.LogLevel.None; client = new Client(55863); client.LoadResources(); client.Start(); Command.RegisterCommand(new PSKCommand(client)); Command.RegisterCommand(new CertificateFileCommand(client)); BootstrapCommand bootstrapCommand = new BootstrapCommand(client); Command.RegisterCommand(bootstrapCommand); ConnectCommand connectCommand = new ConnectCommand(client); Command.RegisterCommand(connectCommand); Command.RegisterCommand(new EchoCommand()); Command.RegisterCommand(new FCAPCommand(client)); Command.RegisterCommand(new HelpCommand()); Command.RegisterCommand(new SaveCommand(client)); Command.RegisterCommand(new SetResourceCommand(client)); Command.RegisterCommand(new DisplayResourceCommand(client)); Command.RegisterCommand(new Command() { Name = "quit" }); Command.RegisterCommand(new Command() { Name = "exit" }); bool bootstrap = true; if (client.HaveBootstrap()) { Console.Write("Connect to server ("); if (client.ConnectToServer()) { Console.WriteLine("Complete"); bootstrap = false; } else Console.WriteLine("Failed"); } if (bootstrap) { //bootstrapCommand.Parameters.Add("coap://delmet-hp.we.imgtec.org:15685"); //bootstrapCommand.Parameters.Add("coap://we-dev-lwm2m1.we.imgtec.org:15685"); //bootstrapCommand.Execute(); } Console.WriteLine("Type quit to stop the LWM2M client (type help to see other commmands)."); while (true) { Console.Write('>'); Command command = Command.Parse(Console.ReadLine()); if (command != null) { if ((string.Compare(command.Name, "quit", true) == 0) || (string.Compare(command.Name, "exit", true) == 0)) break; else { command.Execute(); } } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); Console.WriteLine("Press enter to exit..."); Console.ReadLine(); } finally { if (client != null) { client.Stop(); client.SaveResources(); } } }