Esempio n. 1
0
 public ExThread(ZenSensorDesc sensor, int device_No, ZenClientHandle_t device_Handle, ZenSensorHandle_t device_Sensor)
 {
     this.mSensor       = sensor;
     this.device_No     = device_No;
     this.device_Handle = device_Handle;
     this.device_Sensor = device_Sensor;
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            ZenClientHandle_t zenHandle = new ZenClientHandle_t();

            OpenZen.ZenInit(zenHandle);

            ExThread obj = new ExThread(zenHandle);

            // Creating thread
            // Using thread class
            Thread thr = new Thread(new ThreadStart(obj.sensorEventThread));

            thr.Start();

            // start sensor listing, new sensors will be reported as Events in our event thread
            OpenZen.ZenListSensorsAsync(zenHandle);

            while (!obj.mSearchDone)
            {
                Console.WriteLine("Searching for sensors ...");
                Thread.Sleep(1000);
            }

            if (obj.mFoundSensors.Count == 0)
            {
                Console.WriteLine("No sensor found on the system");
                OpenZen.ZenShutdown(zenHandle);
                thr.Abort();
                return;
            }

            ZenSensorInitError sensorInitError = ZenSensorInitError.ZenSensorInitError_Max;

            // try three connection attempts
            for (int i = 0; i < 3; i++)
            {
                ZenSensorHandle_t sensorHandle = new ZenSensorHandle_t();
                sensorInitError = OpenZen.ZenObtainSensor(zenHandle, obj.mFoundSensors[0], sensorHandle);
                Console.WriteLine("Connecting to sensor " + obj.mFoundSensors[0].identifier + " on IO interface " + obj.mFoundSensors[0].ioType);
                if (sensorInitError == ZenSensorInitError.ZenSensorInitError_None)
                {
                    Console.WriteLine("Succesfully connected to sensor");
                    break;
                }
            }

            if (sensorInitError != ZenSensorInitError.ZenSensorInitError_None)
            {
                Console.WriteLine("Could not connect to sensor");
                System.Environment.Exit(1);
            }

            // stream some data
            Thread.Sleep(5000);

            OpenZen.ZenShutdown(zenHandle);
            thr.Abort();
        }
Esempio n. 3
0
    public static ZenError ZenReleaseSensor(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenReleaseSensor(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 4
0
    public static ZenError ZenSensorExecuteProperty(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, int property)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenSensorExecuteProperty(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), property);

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 5
0
    public static ZenError ZenSensorComponentGnnsForwardRtkCorrections(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, ZenComponentHandle_t componentHandle, string rtkCorrectionSource, string hostname, uint port)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenSensorComponentGnnsForwardRtkCorrections(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), ZenComponentHandle_t.getCPtr(componentHandle), rtkCorrectionSource, hostname, port);

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 6
0
    public static ZenError ZenListSensorsAsync(ZenClientHandle_t handle)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenListSensorsAsync(ZenClientHandle_t.getCPtr(handle));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 7
0
    public static bool ZenSensorComponentIsExecutableProperty(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, ZenComponentHandle_t componentHandle, int property)
    {
        bool ret = OpenZenPINVOKE.ZenSensorComponentIsExecutableProperty(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), ZenComponentHandle_t.getCPtr(componentHandle), property);

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 8
0
    public static ZenError ZenSensorComponentSetArrayProperty(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, ZenComponentHandle_t componentHandle, int property, ZenPropertyType type, SWIGTYPE_p_void buffer, uint bufferSize)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenSensorComponentSetArrayProperty(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), ZenComponentHandle_t.getCPtr(componentHandle), property, (int)type, SWIGTYPE_p_void.getCPtr(buffer), bufferSize);

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 9
0
    public static ZenError ZenSensorComponentSetUInt64Property(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, ZenComponentHandle_t componentHandle, int property, ulong value)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenSensorComponentSetUInt64Property(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), ZenComponentHandle_t.getCPtr(componentHandle), property, value);

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 10
0
    public static string ZenSensorComponentType(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, ZenComponentHandle_t componentHandle)
    {
        string ret = OpenZenPINVOKE.ZenSensorComponentType(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), ZenComponentHandle_t.getCPtr(componentHandle));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 11
0
    public static ZenError ZenSensorComponentGetUInt64Property(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, ZenComponentHandle_t componentHandle, int property, SWIGTYPE_p_unsigned_long_long outValue)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenSensorComponentGetUInt64Property(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), ZenComponentHandle_t.getCPtr(componentHandle), property, SWIGTYPE_p_unsigned_long_long.getCPtr(outValue));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 12
0
    public static ZenError ZenSensorGetInt32Property(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, int property, SWIGTYPE_p_int outValue)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenSensorGetInt32Property(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), property, SWIGTYPE_p_int.getCPtr(outValue));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 13
0
    public static ZenError ZenPublishEvents(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, string endpoint)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenPublishEvents(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), endpoint);

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 14
0
    public static ZenAsyncStatus ZenSensorUpdateIAPAsync(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, SWIGTYPE_p_unsigned_char buffer, uint bufferSize)
    {
        ZenAsyncStatus ret = (ZenAsyncStatus)OpenZenPINVOKE.ZenSensorUpdateIAPAsync(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), SWIGTYPE_p_unsigned_char.getCPtr(buffer), bufferSize);

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 15
0
    public static ZenSensorInitError ZenObtainSensor(ZenClientHandle_t clientHandle, ZenSensorDesc desc, ZenSensorHandle_t outSensorHandle)
    {
        ZenSensorInitError ret = (ZenSensorInitError)OpenZenPINVOKE.ZenObtainSensor(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorDesc.getCPtr(desc), ZenSensorHandle_t.getCPtr(outSensorHandle));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 16
0
    public static bool ZenSensorEquals(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, ZenSensorDesc desc)
    {
        bool ret = OpenZenPINVOKE.ZenSensorEquals(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), ZenSensorDesc.getCPtr(desc));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 17
0
    public static ZenError ZenSensorComponentsByNumber(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, string type, uint number, ZenComponentHandle_t outComponentHandle)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenSensorComponentsByNumber(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), type, number, ZenComponentHandle_t.getCPtr(outComponentHandle));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 18
0
    public static ZenError ZenSensorComponents(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, string type, SWIGTYPE_p_p_ZenComponentHandle outComponentHandles, SWIGTYPE_p_size_t outLength)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenSensorComponents(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), type, SWIGTYPE_p_p_ZenComponentHandle.getCPtr(outComponentHandles), SWIGTYPE_p_size_t.getCPtr(outLength));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 19
0
    public static ZenPropertyType ZenSensorComponentPropertyType(ZenClientHandle_t clientHandle, ZenSensorHandle_t sensorHandle, ZenComponentHandle_t componentHandle, int property)
    {
        ZenPropertyType ret = (ZenPropertyType)OpenZenPINVOKE.ZenSensorComponentPropertyType(ZenClientHandle_t.getCPtr(clientHandle), ZenSensorHandle_t.getCPtr(sensorHandle), ZenComponentHandle_t.getCPtr(componentHandle), property);

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 20
0
    public static ZenSensorInitError ZenObtainSensorByName(ZenClientHandle_t clientHandle, string ioType, string sensorIdentifier, uint baudRate, ZenSensorHandle_t outSensorHandle)
    {
        ZenSensorInitError ret = (ZenSensorInitError)OpenZenPINVOKE.ZenObtainSensorByName(ZenClientHandle_t.getCPtr(clientHandle), ioType, sensorIdentifier, baudRate, ZenSensorHandle_t.getCPtr(outSensorHandle));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 21
0
    public static bool ZenPollNextEvent(ZenClientHandle_t handle, ZenEvent outEvent)
    {
        bool ret = OpenZenPINVOKE.ZenPollNextEvent(ZenClientHandle_t.getCPtr(handle), ZenEvent.getCPtr(outEvent));

        if (OpenZenPINVOKE.SWIGPendingException.Pending)
        {
            throw OpenZenPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 22
0
        private void connect_Device4_Click(object sender, EventArgs e)
        {
            device4_Handle = new ZenClientHandle_t();
            device4_Sensor = new ZenSensorHandle_t();

            connectedDevice[3] = foundSensors[device_List4.SelectedIndex].identifier;
            ExThread exThread = new ExThread(foundSensors[device_List4.SelectedIndex], 4, device4_Handle, device4_Sensor);

            device4_Thread = new Thread(new ThreadStart(exThread.sensorEventThread));
            device4_Thread.Start();
        }
Esempio n. 23
0
        public static void main()
        {
            // Start of Code
            ZenClientHandle_t zenHandle = new ZenClientHandle_t();

            OpenZen.ZenInit(zenHandle);

            ExThread obj = new ExThread(zenHandle);

            // Creating thread
            // Using thread class
            thr = new Thread(new ThreadStart(obj.sensorEventThread));
            thr.Start();

            // start sensor listing, new sensors will be reported as Events in our event thread
            OpenZen.ZenListSensorsAsync(zenHandle);

            while (!obj.mSearchDone)
            {
                Console.WriteLine("Searching for sensors ...");
                Thread.Sleep(1000);
            }

            ZenSensorInitError sensorInitError = ZenSensorInitError.ZenSensorInitError_Max;

            // try three connection attempts
            for (int i = 0; i < 10; i++)
            {
                ZenSensorHandle_t sensorHandle = new ZenSensorHandle_t();
                sensorInitError = OpenZen.ZenObtainSensor(zenHandle, obj.mFoundSensors[0], sensorHandle);
                if (sensorInitError == ZenSensorInitError.ZenSensorInitError_None)
                {
                    Console.WriteLine("Succesfully connected to sensor");
                    break;
                }
            }

            if (sensorInitError != ZenSensorInitError.ZenSensorInitError_None)
            {
                Console.WriteLine("Could not connect to sensor");
                System.Environment.Exit(1);
            }
        }
Esempio n. 24
0
 public ExThread(ZenClientHandle_t zenHandle)
 {
     mZenHandle = zenHandle;
 }
Esempio n. 25
0
    public static ZenError ZenInit(ZenClientHandle_t outHandle)
    {
        ZenError ret = (ZenError)OpenZenPINVOKE.ZenInit(ZenClientHandle_t.getCPtr(outHandle));

        return(ret);
    }
Esempio n. 26
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ZenClientHandle_t obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }