Hallo csharp'ers
I am trying to call a function on a COM (dll) object from managed c#
code, which will send data to another node using an already existing
bluetooth connection. However, I get a "System.ArgumentException" with
explanation "The parameter is incorrect" when calling
L2C_SendData_Issue(...)
The function declaration in C#:
L2C_SendData_Issue(object vau8BDAddr, object vu16LCID, ref object
pvau8Data, vu16DataSize)
vau8BDAddr: array of size of 6 unsigned 8 bit values
(VT_ARRAY|VT_UI1). This is the unique Bluetooth address of the target
device.
vu16LCID: unsigned 16 bit value (VT_UI2). Channel identifier (CID)
representing a local logical channel endpoint.
pvau8Data: pointer to array of unsigned 8 bit values
(VT_ARRAY|VT_UI1). Pointer to a data area to be transmitted.
vu16DataSize: unsigned 16 bit value (VT_UI2). The parameter specifies
the size of the data to be transmitted. This value is in bytes.
My function looks like this:
public void Send(byte[] addr, byte[] data, int length)
{
object tempData = (object) data;
ushort tempLength = (ushort)length;
try
{
pL2C.L2C_SendData_Issue((object)addr, (object)var_LCID, ref tempData,
tempLength);
}
catch(Exception ex) {Log("Exception occured: " + ex.Message);};
}
I don't know which parameter that causes the error, but I suspect the
3rd (ref object). Any suggestions? Please help!