hi everybody, i try to do something working like in VB from windoze for my M341i, so i try to use the monodevel, but i have just litlle knoweldge about vb not C, somebody can help me, i find the file attachment on mono website as sample code to use serial on linux, it do something i can see in irdadump but i don't understand how to send multiple data with a waiting time between each send , i would like to "multiplex" my vb sequence who works fine with sample to just do in first time :
conect
list folder
go into IMAGES dir
get the img.jpg file

for the mono .cs file you must do as explain here http://www.mono-project.com/HowToSystemIOPorts#Example_Code
Before i put /dev/ircomm0 to replace the tty.
and i would like to send binary like byte(0) = 120
byte(1) = 36 byte(3) = 56 ....
serialportcom.write(byte,0,xx)
Thanks

_________________________________________________________________
Retrouvez tout en un clin d'œil avec Windows Desktop Search ! http://desktop.msn.fr/

Attachment: Principale.vb
Description: Binary data

using System;
using System.IO.Ports;

public class SerialPortTest
{
	public static void Main(string[] args)
	{
		SerialPortTest myTest = new SerialPortTest();
		myTest.Test();
	}

	private SerialPort mySerial;

	// Constructor
	public SerialPortTest()
	{
	}

	public void Test()
	{
		if (mySerial != null)
			if (mySerial.IsOpen)

				mySerial.Close();

		mySerial = new SerialPort("/dev/ircomm0", 115200);
		

		mySerial.Open();


		mySerial.ReadTimeout = 400;

		SendData("AT +CKPD="+"E");
		Console.WriteLine(ReadData()); // Should output some information about your modem firmware
		SendData("80 00 07 12 00 04 00");
		Console.WriteLine(ReadData()); 
		SendData("80 00 07 12 00 04 00");
		Console.WriteLine(ReadData()); 
		SendData("80 00 07 12 00 04 00");
		Console.WriteLine(ReadData()); 
		SendData("80 00 07 12 00 04 00");
		Console.WriteLine(ReadData()); 
		SendData("80 00 07 12 00 04 00");
		Console.WriteLine(ReadData()); 
		SendData("80 00 07 12 00 04 00");
		Console.WriteLine(ReadData()); 
		SendData("80 00 07 12 00 04 00");
		Console.WriteLine(ReadData()); 

	}

	public string ReadData()
	{
		byte tmpByte;
		string rxString = "";
			
		tmpByte = (byte) mySerial.ReadByte();

		while (tmpByte != 255)
		{
			rxString += ((char) tmpByte);
		
			tmpByte = (byte) mySerial.ReadByte();			
		}
	
		return rxString;
	}

	public bool SendData(string Data)
	{
		// To send a string, we need to first convert to a character array
		char[] charData = Data.ToCharArray();

		// Then convert to a byte array
		byte[] byteData = new byte[charData.Length];
		for (int cnt = 0; cnt < byteData.Length; cnt++)
			byteData[cnt] = (byte) charData[cnt];

		// We send the serial data
		mySerial.Write(byteData, 0, byteData.Length);

		return true;		
	}
} 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Openobex-users mailing list
[email protected]
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to