|
Hi there,
is there a way to know if the device has the data 100% available for reading?
What i do is the following:
a) send a write to the device [a request to 'gather' stuff for me to read later]
b) read the 'prepared' data
I use System.IO.Ports.SerialPort from the .Net 2.0 framework.
It seems that the write/read [a & b] part is too fast for the device. It does not have all data prepared.
Sometimes the data need to read is 10 bytes, an other time it is 20000 bytes. No 'logic' there.
Is there a way to tell if the device has the data complete for me to read back to the pc?
Thanx,
Jan
[ps. this is like a post i did earlier, however this is addressing the actual problem better]
|
|
|
|
|
Only if the device tells you through the serial port. Other than that, no there isn't.
The only method you have is to just read the Serial port until you have all the data you EXPECT to recieve, discarding everything else, or the device tells you it's sent you the complete data package.
Most of the code you're going to write for this depends on the device and what it sends you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave,
thanks for the info.
Indeed it seems like a loop until nothing else is available. The thing is that the device has very little documentation when it comes to communication.
Will have to learn by testing it over and over and over and over and over and over and ...
|
|
|
|
|
Doing research like this is 75% of a developers job...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, but if it is an undocumented issue, it's trial and error for a long time to come
|
|
|
|
|
Yep!
Nothing like groping around in the dark, is there?
If you little to nothing of the language the device speaks, how could you possibly carry on an intelligent conversion with it?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In principle i have a small list of commands which i can send so it can gather the info i need, like a list of all available files on it and the possibility to retrieve a file.
It can also send data 'realtime' but if have not been able to collect that.
Something to do is to know if it 'preparing-data' or 'in-rest-mode'.
Could use threads,...let one wait if data is available,...not failsafe, some threads could never be triggered.
The problem is that stuff like 'end-of-transfer' is not available.
I was using something like:
<br />
if port.BytesToRead > 0 then add it to a string and later parse that string<br />
The problem with that logic is that it's not the way for this device. It works only when:
<br />
try<br />
{<br />
for i = 0 to 999999<br />
read byte and add it to cumulative string<br />
}<br />
catch<br />
{<br />
}<br />
...otherwise BytesToRead will be 0 at one time eventhough there should [and 1ms later] be more data available.
There is a commercial tool which can do the same as i do, however the tool is very user-unfriendly.
-- modified at 21:27 Saturday 10th September, 2005
|
|
|
|
|
To get this 100% accurate, you're going to have to contact the manufacturer of the device and get more documentation on what this thing can do.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
is there a way to update datagrid from dataset, with out loosing current datagrid view (scroll position) and cell position. im only updating row data, not insering new row. and im not doing it directly to datagrid.
|
|
|
|
|
hi all,
i have given columnstyles for datagrid, texbox columnstyle, datetimepicker and combobox..
my problem is that, when at runtime, i press the TAB key, the cursor moves two places...can any one tell me why this happens and how to get it to move just one place.
kindly do reply..
thanx in advance
|
|
|
|
|
To me this sounds as a problem with your tabindex. Set a proper tabindex property to each object, and it will work correctly.
|
|
|
|
|
i have a small problem in regex. I have string that contains the following text:
The oStarthereptional para
meter "dis
tributions" is a list of dis
tributiongroups, enclosed in
angle brackets. If specified,
the distribution
portion of a new newsgroup (e.g,
’net’ in ’net.wombat’) will be
examined for a match with the
distributiendon categorie
s listed, and
only those new newsgroups wh
ich
Now, suppose i wanted to extract all the text between Starthere and end - how would I do that? Many lines are terminated byt a carriage return/ line feed pair etc.
|
|
|
|
|
Use a pattern that contains a set that matches any character, like "Starthere[\w\W]*end".
---
b { font-weight: normal; }
|
|
|
|
|
i am developing an app that needs to access a web site ( the site is an online manager for my fax machine) i need the app to look at the page that contains the stored faxes, i then need it to be able to store these fax images (as multi-page TIF files), the problem i am having intially, is to be able to 'turn' the page of images, as there are 9 pages of them, the button to move to teh next page on teh site is controlled by a javascript function, and i dont know how to use POST to be able to call the javascript function, or if its even possible, i am very new to c# and web components as well
Any help that i can get would be really appreciated
thaynann
|
|
|
|
|
HttpWebRequest only downloads content, it doesn't do any interpretation of the content. Automating IE is probably the least complicated solution for what you want to do. This is an example of automating the webbrowser control and there are several more on the site: http://www.codeproject.com/cs/miscctrl/WebBrowserEx.asp[^]
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Thanx for the link, ill have a look through it to see if it will do wat i need it to, hopefully it will, thanx again
|
|
|
|
|
Hi,
How can i display Raster(Fixed pitch)font in c#
or how can i convert them to other type, say Open Type font, in order to display it
Thanx.
|
|
|
|
|
Please help me out with this problem:
I have a string where some data is stored.Ihave to deserialize this string to data value object.How to do it.
|
|
|
|
|
You could try converting the string to bytes using one of the System.Text.XXXEncoding classes and then wrap it in a MemoryStream . You could then use the MemoryStream as a parameter to the appropriate formatter (Binary/XML) and deserialize the object.
Sample code (doesn't compile)
byte []b = System.Text.ASCIIEncoding.GetBytes(text);
using (MemoryStream ms = new MemoryStream(b))
{
YourClass obj = new BinaryFormatter(typeof(YourClass)).Deserialize(ms);
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
R/sir
I am student of BCS I want to make my final project on Antivirus. I also want to give the user the facility of compression, zipping, encryption, spy agent, recover Files, security purpose (just tell me how can I get the number of hard disk through Software) and streaming (how many hrs, days) user can use this one.Please help me step by step approach because this is my first ever project and If it is possible please provide me code which will guide up to the end. I have just One month left so it is kindly requested to help me as soon as you have this mail.
Waiting your kind reply
Muhammad junaid.
|
|
|
|
|
muhammad junaid wrote:
Please help me step by step approach because this is my first ever project and If it is possible please provide me code which will guide up to the end. I have just One month left so it is kindly requested to help me as soon as you have this mail.
You're kidding right ?
Let me paraphrase
'I am a student who has to hand in a project. This is the first thing I've ever written, and I'd like to singlehandedly write something in a month that a team of qualified, experienced professionals would take much longer for. I recognise this is a challenge, so if you could provide me with the source code, it would really help.'
I think you have two options here
1. hack into Nortons servers and steal their code
2. use magic
I suggest rethinking your project, with a month to write it, you should choose something where you have some idea how to go about it when you start. Otherwise, it will be two weeks in before you realise you're incapable of doing it, and then you'll have no time to do something else.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I started laughing when reading this, I am a student, this is my final project... this is my first project ever!
|
|
|
|
|
Yeah, it's REALLY sad, but there's a lot of it going around.
Although, these are the people hoping to compete with me for jobs, so that I can live with.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
No, I think that what he was doing was looking for a rent-a-coder site. That is what I thought this was at first.
|
|
|
|
|
Yeah, he seems typical of what you get on rentacoder. I worked there briefly, the people who run it are lying scum, and the whole system is designed to rip off coders.
Christian Graus - Microsoft MVP - C++
|
|
|
|