Mono linux and peak usb
-
- Posts: 3
- Joined: Mon 15. Apr 2013, 12:04
Mono linux and peak usb
Hello,
I am a c# developer, and i have a c# app for windows wich do a lot stuff on the can bus (with pcan usb).
Now i need also a app for linux programmed in c# wich do the same things.
I know about the mono stuff.
My app is already compiling.
But i have one problem.
How can i establish a connection the the pcan-usb with C# and linux.
Do some has some example??
BR
I am a c# developer, and i have a c# app for windows wich do a lot stuff on the can bus (with pcan usb).
Now i need also a app for linux programmed in c# wich do the same things.
I know about the mono stuff.
My app is already compiling.
But i have one problem.
How can i establish a connection the the pcan-usb with C# and linux.
Do some has some example??
BR
Re: Mono linux and peak usb
Hello,
sorry, but at the moment we (PEAK) do not have any examples for C# and Linux.
regards
Michael
sorry, but at the moment we (PEAK) do not have any examples for C# and Linux.
regards
Michael
-
- Posts: 3
- Joined: Mon 15. Apr 2013, 12:04
Re: Mono linux and peak usb
Do you think that in the next weeks you will have example for c# and linux?
May be you can take a look at the following code
I try to access the pcan with the following paratmert
but the ptr is still zero
but when i try "cat /dev/pcan33" i will see all canmessages on the bus
when i enter "cat /proc/pcan" in console i will get
May be you can take a look at the following code
Code: Select all
using TPCANHandle = System.Byte;
[Flags]
public enum PCANInitMessageType
{
Extended = 0x01,
Standard = 0x00,
}
public static class PCANBasicLinux
{
private const string PCAN_DLL = "/lib/libpcan.so.0.6";
[DllImport(PCAN_DLL, EntryPoint = "LINUX_CAN_Open")]
public static extern IntPtr CanOpen(
[MarshalAs(UnmanagedType.BStr)]
string deviceName,
[MarshalAs(UnmanagedType.U4)]
int nFlag);
[DllImport(PCAN_DLL, EntryPoint = "CAN_Init")]
public static extern int Init(
IntPtr handle,
[MarshalAs(UnmanagedType.U2)]
TPCANBaudrate Btr0Btr1,
[MarshalAs(UnmanagedType.I4)]
PCANInitMessageType msgType);
[DllImport(PCAN_DLL, EntryPoint = "CAN_Close")]
public static extern int Close(IntPtr handle);
[DllImport(PCAN_DLL, EntryPoint = "CAN_Status")]
public static extern TPCANStatus GetStatus(IntPtr handle);
[DllImport(PCAN_DLL, EntryPoint = "CAN_Read")]
public static extern TPCANStatus Read(
IntPtr hanlde,
out TPCANMsg MessageBuffer);
[DllImport(PCAN_DLL, EntryPoint = "CAN_Write")]
public static extern TPCANStatus Write(
IntPtr hanlde,
ref TPCANMsg MessageBuffer);
[DllImport(PCAN_DLL, EntryPoint = "nGetLastError")]
public static extern int GetLastError();
}
Code: Select all
IntPtr ptr = PCANBasicLinux.CanOpen("/dev/pcan33", 0x02);
but when i try "cat /dev/pcan33" i will see all canmessages on the bus
when i enter "cat /proc/pcan" in console i will get
Code: Select all
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20130131_n (7.8.0) Apr 15 2013 11:05:31 --------------
*------------------------------- [mod] [usb] --------------------------------
*--------------------- 2 interfaces @ major 248 found -----------------------
*n -type- ndev --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb -NA- ffffffff 012 0x011c 00000091 00000000 00000095 00000000 0x0000
33 usb -NA- ffffffff 013 0x031c 00000000 00000000 0000005b 00000010 0x0000
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Mono linux and peak usb
I do not understand on which LIB you like to implemnt the C# Interface? Please send us a short e-mail to support@peak-system.com and we could send you some Beta code for the PCAN-Basic for LINUX Implementation.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Mono linux and peak usb
Hi,
I'm developing a mono application (Linux c#) using peak systems device too.
There is any information, samples since then?
@first_zyrex: do you have som control class which could be used by me?
Thank you
Marc CG
I'm developing a mono application (Linux c#) using peak systems device too.
There is any information, samples since then?
@first_zyrex: do you have som control class which could be used by me?
Thank you
Marc CG
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Mono linux and peak usb
No, we do not offer any samples for MONO - please search on Linux Forums - this is the wrong Forum.
Our PCAN-Basic for Linux Package could be download from our Support Page. We only official support C++/Java and Python. It will be possible to run with all available programming languages, but we could not build samples for every languages.
Inside the package you have the complete source - so it will no problem to build your own C# header, or try to use the PCAN-Basic for Windows C# Header as template. If you have success, you could post the result here - maybe there are other users which find it usefull.
Our PCAN-Basic for Linux Package could be download from our Support Page. We only official support C++/Java and Python. It will be possible to run with all available programming languages, but we could not build samples for every languages.
Inside the package you have the complete source - so it will no problem to build your own C# header, or try to use the PCAN-Basic for Windows C# Header as template. If you have success, you could post the result here - maybe there are other users which find it usefull.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
Re: Mono linux and peak usb
Hi,
I Checked out the windows C# Example code and it helped me.
But I saw that it uses chardev to connect and disconnect. Do you have any c# sample code using netdev?
Which option would you recommend for a non continuous communication aplication?
Thanks
Marc CG
I Checked out the windows C# Example code and it helped me.
But I saw that it uses chardev to connect and disconnect. Do you have any c# sample code using netdev?
Which option would you recommend for a non continuous communication aplication?
Thanks
Marc CG
- PEAK-Support
- Sales & Support
- Posts: 1646
- Joined: Fri 10. Sep 2010, 19:34
Re: Mono linux and peak usb
In this Forum from PEAK-System, we only could do support for our own CAN Driver CharDev.
If you want support from the community driver NetDev, please post on a NetDev/SocketCAN related page.
Both drivers could be use for your application - but it´s your decission which you like to use...
If you want support from the community driver NetDev, please post on a NetDev/SocketCAN related page.
Both drivers could be use for your application - but it´s your decission which you like to use...
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------