mtconnect / dot_net_sdk Goto Github PK
View Code? Open in Web Editor NEWAn assembly for the Microsoft .NET framework, based on the MC2 class.
License: Apache License 2.0
An assembly for the Microsoft .NET framework, based on the MC2 class.
License: Apache License 2.0
Hello! Sorry for stupid question, but:
When I starting WinForm project (AdapterLab.exe) i`ve got exception in MachineTools->start_click()->mWave.StartRecording();
An unhandled exception of type 'NAudio.MmException' occurred in NAudio.dll
Additional information: BadDeviceId calling waveInOpen
I seems to me I made something wrong? ...but I dont now what
The steps:
I think that the additional clients are in a queue till the connected client thread is terminated. Ref
Have tried to test the following code and seems to work. Please review.
private void HeartbeatClient(object client)
{
...
// Send intial stream to the client
SendAllTo(clientStream);
...
try
{
while (mRunning && tcpClient.Connected)
{
...
}
}
}
private void ListenForClients()
{
mRunning = true;
try
{
while (mRunning)
{
//create a thread to handle a new communication
Thread clientThread = new Thread(new ParameterizedThreadStart(HeartbeatClient));
//.AcceptTcpClient() blocks until a client has connected to the adapter
// a connection attaches the new client to the new thread
clientThread.Start(mListener.AcceptTcpClient());
}
}
catch (Exception e)
{
Console.WriteLine("Execption occurred waiting for connection: " + e.Message);
}
finally
{
mRunning = false;
mListener.Stop();
}
}
The "Overview" and "Hands-on tutorial" videos that are linked are coming up as "private", meaning I cannot view them. Can the be made public?
Hi,
Has anyone had the following error using this library:
"Exception occurred waiting for connection: A blocking operation was interrupted by a call to WSACancelBlockingCall"
I am initializing the adapter object (MTConnect.Adapter) in the main thread and then using the SendChanged() method in a C# task. See below:
public void StartAdapter()
{
runLoop = true;
adapter.Start();
machine.Connect();
mainTask = new Task(() =>
{
RunLoop();
});
mainTask.Start();
}
private void RunLoop()
{
while (runLoop) {
try
{
GetCurrentMachineData(machine);
mode.Value = machine.Mode;
execution.Value = machine.Status;
program.Value = machine.Program;
state.Value = machine.State;
spindleOverride.Value = machine.OverrideValues.speedOverride;
feedOverride.Value = machine.OverrideValues.feedOverride;
rapidOverride.Value = machine.OverrideValues.rapidOverride;
//errorState.Value = machine
//errorMessage.Value = machine.ErrorList[0].errorDescription;
//Update adapter stream
adapter.SendChanged();
System.Threading.Thread.Sleep(pauseTime);
}
catch
{
Console.WriteLine("Machine is not connected");
System.Threading.Thread.Sleep(10 * pauseTime);
}
}
}
public void StopAdapter()
{
machine.Disconnect();
adapter.Stop();
}
protected void CancelHandler(object sender, ConsoleCancelEventArgs args)
{
runLoop = false;
mainTask.Wait();
StopAdapter();
}
CancelHandler is subscribed to Console.CancelKeyPress
I'm getting the WSACancelBlockingCall exception at
mListenThread.Join(2000);
Any suggestions?
When the Stop method is called on an instance of the adapter there is a 20-second delay before continuing. After that the application continue running until its closing, but a library thread continue running and it doesn't allow the application to close completely, this issue does not permit the application to run again until the thread is killed by the task manager. This issue is only noticeable when the agent is missing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.