|
vikki0286 wrote: what command i need to send to get data from the USB
Out of the thousands of dongles that there are, how on earth would I know which one you are using? Read the documentation for the dongle. If you can't figure it out then ask the manufacturer. They have support people and supporting their product is what they are paid to do.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
It looks like a standard Comm port: 115.2KB, N,8,1.
We have a specific wireless protocol which defines the communication packets across the port.
In general, however, the communication is ASCII encoded HEX ending in a CR/LF pair.
The general packet structure is:
Packet Structure (TBD bytes maximum)
ll pp dd dd dd ss ss ss nn bb bb ....... bb ir
|| || || || || || || || || || || ||
|| || || || || || || || || || || xx-- Transaction ID (i:Packet ID [0h-Fh]; r:Retry Count [0h-Fh])
|| || || || || || || || || || || (00 for PC-->USB part of PC-->USB-->Remote communication;
|| || || || || || || || || || || (not sent/used for PC-->USB or USB-->PC Only communication)
|| || || || || || || || || xx-xx-.......-xx----- Data Bytes [0-TBDd]
|| || || || || || || || xx---------------------- Command/Data (see Commands below)
|| || || || || xx xx xx------------------------- Source ID [000001h-FFFFFFh]
|| || xx xx xx---------------------------------- Destination ID [000001h-FFFFFFh, 000000h:broadcast]
|| xx------------------------------------------- Project ID [00h-FFh]
xx---------------------------------------------- Packet Length-1 [08h-FFh]
And, as an example, the packet received for an event burst is:
9A{*B0 or *B1} - Report ‘Event’ Burst
CD 00 dd dd dd ss ss ss 9A tt tt tt tt xx(0) yy(0) zz(0)..xx(63) yy(63) zz(63) ir
- tt tt tt tt: event time stamp (see Firmware Notes)
- xx(n) yy(n) zz(n): 2’s comp. 8-bit acceleration array data
- Response {9A} is sent each time an 'Event' is detected.
how can i do get and send data to com port using Serial port class.
Thanks
|
|
|
|
|
Nobody is going to write the code for you. Read the documentation.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
yes i know no body can do for me.i just want to get idea.because i am doing work first time with com port.
i got the code to connect with Com Port,i can connect with COM PORT using Serials port class.
i would like to know one thing, how can i run the commands on the com port
to send and retrieve data.
Thanks
Vikas
|
|
|
|
|
I want to access usb printer details using snmp. But i am not able to connect it through c#.net. How can i connect my c# app to usb printer?
|
|
|
|
|
You might try reading through this[^] and see if that helps.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Thank You for giving me this link.
My dear i was gone through this. But i don't understand it. I am new in the .net technology.So it might take so much time to convert "English" lines into "coding" . I want some coding part so that i would understand and implement it.
|
|
|
|
|
Hi, i have a little bit of a problem using xml and mysql in c#. let me show you how this works:
This is how my program works,
this is a treeview that you select a node from
|--------------------|
| -FirstNode
|__+FirstChild
|__+SecondChild
|__+ThirdChild
| -SecondNode
|__+FirstChild
|__+SecondChild
|__+ThirdChild
|--------------------|
and in this datagridview it will show data from the database, based on what treeview node you select.
|-------------------------------|
|Year|Class|Open|Locked|
|-----|--------|------|---------|
|-----|--------|------|---------|
|-----|--------|------|---------|
|-----|--------|------|---------|
|-----|--------|------|---------|
|-----|--------|------|---------|
|-----|--------|------|---------|
|-------------------------------|
And the database is built like this:
there are databases (named after the two root nodes in the xml treeview),
FirstNode
SecondNode
Under these databases is the information i want into the datagridview.
and now to the problem, i can't select one of the child nodes without getting information from both of the nodes.
as in example, if i press the first node. everything in the database FirstNode is posted into the datagridview as i want, and that goes to the same for SecondNode. But when i press one of the child nodes i get the information from both of the cilds in both roots. is there a way to make them unique so i can get the correct information from only one of the child nodes? i can post code if that would help you.
Thanks, from Perry
|
|
|
|
|
i think a code sample will be required to help you here, specifically the code that loads the data to be shown when you select an item on the tree view.
|
|
|
|
|
<blockquote class="FQ">
<div class="FQA">Quote:</div>
XElement doc = XElement.Load(Config.Default.LocXML + Config.Default.NameXML);
foreach (XElement xmls in doc.Descendants("S"))
{
foreach (XElement xmly in xmls.Descendants("Y"))
{
foreach (XElement xmlc in xmly.Descendants("C"))
{
if (treeView1.SelectedNode.Text == xmls.Attribute("name").Value)
{
DuHarValgt.Text = "Vennligst velg en klasse til venstre.";
ValgtKlasse.Text = "<---------------";
DenneEr.Text = "";
ÅpenEllerStengt.Text = "";
DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Visible = false;
button1.Text = "Velg en Klasse";
button1.Enabled = false;
button1.BackColor = Config.Default.BTNone;
if (clear == true)
{
dataGridView1.Rows.Clear();
clear = false;
}
string Åpent = null;
string Låst = null;
MySqlCommand cm11 = new MySqlCommand("SELECT `Åpent` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
using (MySqlDataReader reader11 = cm11.ExecuteReader())
{ while (reader11.Read()) { if (reader11.GetString(0) == "1") { Åpent = reader11.GetString(0); } else if (reader11.GetString(0) == "0") { Åpent = reader11.GetString(0); } } }
if (Åpent == "1") { Åpent = "Ja"; } else { Åpent = "Nei"; }
MySqlCommand cm12 = new MySqlCommand("SELECT `Låst` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
using (MySqlDataReader reader12 = cm12.ExecuteReader())
{ while (reader12.Read()) { if (reader12.GetString(0) == "1") { Låst = reader12.GetString(0); } else if (reader12.GetString(0) == "0") { Låst = reader12.GetString(0); } } }
if (Låst == "1") { Låst = "Ja"; } else { Låst = "Nei"; }
dataGridView1.Rows.Add(xmly.Attribute("name").Value, xmlc.Attribute("name").Value, Åpent, Låst);
}
else if (treeView1.SelectedNode.Text == xmly.Attribute("name").Value)
{
DuHarValgt.Text = "Vennligst velg en klasse til venstre.";
ValgtKlasse.Text = "<---------------";
DenneEr.Text = "";
ÅpenEllerStengt.Text = "";
DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Visible = false;
button1.Text = "Velg en Klasse";
button1.Enabled = false;
button1.BackColor = Config.Default.BTNone;
if (clear == true)
{
dataGridView1.Rows.Clear();
clear = false;
}
string Åpent = null;
string Låst = null;
MySqlCommand cm11 = new MySqlCommand("SELECT `Åpent` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
using (MySqlDataReader reader11 = cm11.ExecuteReader())
{ while (reader11.Read()) { if (reader11.GetString(0) == "1") { Åpent = reader11.GetString(0); } else if (reader11.GetString(0) == "0") { Åpent = reader11.GetString(0); } } }
if (Åpent == "1") { Åpent = "Ja"; } else { Åpent = "Nei"; }
MySqlCommand cm12 = new MySqlCommand("SELECT `Låst` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
using (MySqlDataReader reader12 = cm12.ExecuteReader())
{ while (reader12.Read()) { if (reader12.GetString(0) == "1") { Låst = reader12.GetString(0); } else if (reader12.GetString(0) == "0") { Låst = reader12.GetString(0); } } }
if (Låst == "1") { Låst = "Ja"; } else { Låst = "Nei"; }
dataGridView1.Rows.Add(xmly.Attribute("name").Value, xmlc.Attribute("name").Value, Åpent, Låst);
}
else if (treeView1.SelectedNode.Text == xmlc.Attribute("name").Value)
{
string Åpent = null;
string Låst = null;
DenneEr.Text = "Denne klassen er:";
MySqlCommand cm11 = new MySqlCommand("SELECT `Åpent` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
using (MySqlDataReader reader11 = cm11.ExecuteReader())
{ while (reader11.Read()) { if (reader11.GetString(0) == "1") { Åpent = reader11.GetString(0); } else if (reader11.GetString(0) == "0") { Åpent = reader11.GetString(0); } } }
if (Åpent == "1")
{
ÅpenEllerStengt.Text = "Åpen";
button1.Text = "Steng klassen " + treeView1.SelectedNode.Text;
button1.Enabled = true;
button1.BackColor = Config.Default.BTOpen;
}
else if (Åpent == "0")
{
ÅpenEllerStengt.Text = "Stengt";
button1.Text = "Åpne klassen " + treeView1.SelectedNode.Text;
button1.Enabled = true;
button1.BackColor = Config.Default.BTClosed;
}
MySqlCommand cm12 = new MySqlCommand("SELECT `Låst` FROM " + Config.Default.MySQL_Schema + "." + xmls.Attribute("name").Value + " WHERE `Klasse`='" + xmlc.Attribute("name").Value + "'", cs);
using (MySqlDataReader reader12 = cm12.ExecuteReader())
{ while (reader12.Read()) { if (reader12.GetString(0) == "1") { Låst = reader12.GetString(0); } else if (reader12.GetString(0) == "0") { Låst = reader12.GetString(0); } } }
if (Låst == "1")
{
Låst = "Ja";
DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Visible = true;
DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Text = "Du må vente ca " + Config.Default.TimerButton + " sekunder før du kan åpne eller stenge klassen.";
button1.Text = "Klassen " + treeView1.SelectedNode.Text + " er låst";
button1.Enabled = false;
button1.BackColor = Config.Default.BTWait;
}
else
{
Låst = "Nei";
DuMåVente60SekunderFørDuKanÅpneStengeKlassen.Visible = false;
}
DuHarValgt.Text = "Du har valgt klassen:";
ValgtKlasse.Text = treeView1.SelectedNode.Text;
}
}
}
}
</blockquote>
Here is the code from my treeview afterselect, thanks
Perry ^_^
|
|
|
|
|
I don't know if this is in the right place or not, but I'm going to assume it is and I apologise if it isn't! :P
I've been developing in C# for a year now and it's my first major language and I'm now looking to join a small project to help build my skills, or to even start one up if you have an idea!
My strongest points are Analysis, Implementation and stuff in that general area. I also work considerably well in a team. Although, my weakness would have to be design, as I haven't really gotten very far with it. But I do have basic/possibly intermediate skills in HTML and CSS. My problem is designing in environments like this.
I know things such as basic I/O functions, operation of WMP/iTunes through DLL referencing, xml parsing, class builds, open source libraries, creating automatic update functions (the one in VS is rather crumby, if you ask me!) threading and much more.
So if you're looking for people to help out in your project, even just little, and you're interested in letting me join reply here or send me a message. And if you've read all of this then I both thank and salute you!
modified 4-Aug-12 21:46pm.
|
|
|
|
|
You might want to at least edit your posting and remove your email address. Unless you like the spammers scraping your email and then sending you lots of nice emails for problems you didn't know you had.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Aha yeah you're probably right! I get so much spam mail its unreal. This is probably why I get it all. Thanks for pointing that out.
|
|
|
|
|
You're welcome. And you message probably rightfully belongs in the collaboration forum.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Yeah. I'm new to the website and don't really know much about the forum contents or navigation. My bad.
|
|
|
|
|
Not a problem. Happens all the time.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
I find getting the idea for a project to learn/play on to be the most difficult thing, therefore the few I have I hoard
You could always peruse the codeplex stuff and see if you can join there. I have never used it but I believe it is open source and it seems reasonable that other devs would be welcome on some of the projects, especially if they are not too specialised.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I think this is a problem all developers suffer with, especially ones that are just starting out and learning the ropes. I know its certainly the hardest part for me, which is why I asked this question.
Thanks for that suggest, I just looked on there and there was quite a few interesting projects that I'm applying for. I'd recommend looking there yourself as there are some really promising applications being made.
|
|
|
|
|
|
In a C# 2010 application that uses linq to sql datacontext object that connects to a sql server 2008 r2 database, I need to do a maintenance change to modify the size of a notes field from varchar(500) to varchar(900).
I am getting the error message, "changing the data type of column 'field2' on table 'test1' from 'varchar(500)' to 'varchar (900)' causes the following indexes to exceed the maximum index size of 900 bytes: index2 when change the column size using sql server management studio 2008 r2.
I am assuming that the datacontext object added this notes field to the index? If I am correct or not, can you tell me why a data field of this size would be used as a foreign key by the data context object.
I am trying to determine what my options are to fix this problem. The following is what I noted so far:
1. I saw the table I am referring to is a clustered index and I do not want to change the index for this reason. Note there are several foreign keys in the table I am referring to, however the primary key to this table is an 'int'. The only option I can see is to increase the size of the field to varchar(886) instead of varchar(900).
2. Could I change the field to a text size? This way the field can be the size the user may need. Can you tell me if this is a good option or not any why?
3. Is there a way I could change the data context object so this field is not a foreign key to another table? If so, how would I accomplish this goal?
4. Are there any other options I would have?
|
|
|
|
|
following up on a thread in 'weird and wonderful', should i be calling .dispose at the end of a method on all objects that have it? i just checked the objects in a function here to see which ones have a dispose method (with intellisense) and they are:
//connection.Dispose(); // OleDbConnection
//selectCMD.Dispose(); // OleDbCommand
//adapter.Dispose(); // OleDbDataAdapter
//sources.Dispose(); // DataSet
should i be calling these every time (here and in other functions)?
(ignore the possibility of refactoring for now, unless necessary.)
|
|
|
|
|
Only if you instantiated it and aren't returning it to the caller.
Personally, I prefer to keep my Connections and Commands for the life of the app, so I wrap my Connections and Commands in another class and dispose them in my class' Dispose.
And I don't use DataAdapters and DataSets.
|
|
|
|
|
Countered!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
may be worth looking into the using keyword, for example.
using (var connection = new OleDbConnection())
{
}
MSDN info on the using statement here.
Code project artice also here
|
|
|
|
|
As PIEBALDconsult said: if you create it, you should dispose it when you are finished with it.
The problem is that some objects use scarce resources, and unless they are disposed those resources do not become available for other classes within your app, or other applications until the Garbage Collector identifies them as unused, or the app ends. Since this may not happen for minutes, days, or even months, it is a very good idea to get into the habit of Disposing everything which implements IDispose. This is particularly true of SQL components, Graphics releted items, and files.
You may not notice a problem, but it is potentially there to bite you in production, and extremely difficult to track down and fix - since all you get is normally "out of memory" errors, with no indication of what caused it.
The easiest and cleanest way if to wrap the object in a using block as this also takes the object out of scope when it is Disposed, so that it cannot be accidentally referenced later.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|