示例#1
0
文件: Helper.cs 项目: sm6uax/plegma
        static void OnGetGestureDatacb(SkyWriterSensor sensor, object data)
        {
            List <TupleS <Port, string> > pevents = new List <TupleS <Port, string> >();

            var payload = data as GestureEvents;

            //construct port events
            if (!String.IsNullOrEmpty(payload.airwheel))
            {
                pevents.Add(new TupleS <Port, string>(GestureThing.Ports[3], payload.airwheel));
            }
            if (!String.IsNullOrEmpty(payload.tap))
            {
                pevents.Add(new TupleS <Port, string>(GestureThing.Ports[0], payload.tap));
            }
            if (!String.IsNullOrEmpty(payload.touch))
            {
                pevents.Add(new TupleS <Port, string>(GestureThing.Ports[1], payload.touch));
            }
            if (!String.IsNullOrEmpty(payload.doubletap))
            {
                pevents.Add(new TupleS <Port, string>(GestureThing.Ports[2], payload.doubletap));
            }
            if (!String.IsNullOrEmpty(payload.flick))
            {
                pevents.Add(new TupleS <Port, string>(GestureThing.Ports[4], payload.flick));
            }
            //send portevent message
            Helper.node.SetState(pevents);
        }
示例#2
0
        //------------------------------------------------------------------------------------------------------------------------
        #endregion


        #region Constructor
        //------------------------------------------------------------------------------------------------------------------------
        public SensorWatcher(SkyWriterSensor sensor, Transport sharppy)
        {
            this.sensor                  = sensor;
            this.sharppyiface            = sharppy;
            this.sharppyiface.OnRxMsgcb += OnRxPythonMsg;
            //each sensor has its own watcherid
            WatcherId = Interlocked.Increment(ref idGen);
        }
示例#3
0
文件: Helper.cs 项目: sm6uax/plegma
        static void OnGetPositionDatacb(SkyWriterSensor sensor, object data)
        {
            List <TupleS <Port, string> > pevents = new List <TupleS <Port, string> >();

            var payload = data as PositionData;

            //construct port events
            if (!String.IsNullOrEmpty(payload.x))
            {
                pevents.Add(new TupleS <Port, string>(PositionThing.Ports[0], payload.x));
            }
            if (!String.IsNullOrEmpty(payload.y))
            {
                pevents.Add(new TupleS <Port, string>(PositionThing.Ports[1], payload.y));
            }
            if (!String.IsNullOrEmpty(payload.z))
            {
                pevents.Add(new TupleS <Port, string>(PositionThing.Ports[2], payload.z));
            }
            //send port events message
            Helper.node.SetState(pevents);
        }