Example #1
0
        public void MessageSent(IoState state, byte[] message)
        {
            int pid = state.GetPID();
            int sid = state.GetSID();

            Log.Info(Color.Blue, String.Format("{0}-{1} TX: ", pid, sid) + STR.ToFormatString(message, mSendType));
        }
Example #2
0
        public void MessageReceived(IoState state, byte[] message)
        {
            int pid = state.GetPID();
            int sid = state.GetSID();

            Log.Info(Color.Black, String.Format("{0}-{1} RX: ", pid, sid) + STR.ToFormatString(message, mRecType));
            RelayServer.GetInstance().RelayData(state.GetPID(), message);
        }
Example #3
0
        public static List <ParkGate> QueryByParkingIdAndIoState(string parkingId, IoState ioState)
        {
            if (string.IsNullOrWhiteSpace(parkingId))
            {
                throw new ArgumentNullException("parkingId");
            }

            IParkGate factory = ParkGateFactory.GetFactory();

            return(factory.QueryByParkingIdAndIoState(parkingId, ioState));
        }
Example #4
0
 //public override IoObject clone(IoState state)
 //{
 //    IoObject proto = state.protoWithInitFunc(name);
 //    IoCall result = new IoCall();
 //    uniqueIdCounter++;
 //    result.uniqueId = uniqueIdCounter;
 //    result.state = state;
 //    result.createProtos();
 //    result.createSlots();
 //    result.protos.Add(proto);
 //    return result;
 //}
 public static IoObject with(IoState state, IoObject sender, IoObject target,
     IoObject message, IoObject slotContext, IoObject activated, IoObject coro)
 {
     IoCall call = IoCall.createObject(state);
     call.sender = sender;
     call.target = target;
     call.msg = message;
     call.slotContext = slotContext;
     call.activated = activated;
     call.coroutine = coro;
     call.stopStatus = IoCallStatus.MESSAGE_STOP_STATUS_NORMAL;
     return call;
 }
Example #5
0
        //public override IoObject clone(IoState state)
        //{
        //    IoObject proto = state.protoWithInitFunc(name);
        //    IoCall result = new IoCall();
        //    uniqueIdCounter++;
        //    result.uniqueId = uniqueIdCounter;
        //    result.state = state;
        //    result.createProtos();
        //    result.createSlots();
        //    result.protos.Add(proto);
        //    return result;
        //}

        public static IoObject with(IoState state, IoObject sender, IoObject target,
                                    IoObject message, IoObject slotContext, IoObject activated, IoObject coro)
        {
            IoCall call = IoCall.createObject(state);

            call.sender      = sender;
            call.target      = target;
            call.msg         = message;
            call.slotContext = slotContext;
            call.activated   = activated;
            call.coroutine   = coro;
            call.stopStatus  = IoCallStatus.MESSAGE_STOP_STATUS_NORMAL;
            return(call);
        }
Example #6
0
        public void ConnectOpened(IoState state)
        {
            Log.Out("ConnectOpened," + state.ToString());
            int      pid = state.GetPID();
            int      sid = state.GetSID();
            TreeNode pnode, snode;

            pnode = treeConnect.Nodes[GetNodeKey(pid)];
            if (pnode != null)
            {
                String skey = GetNodeKey(sid);
                snode      = new TreeNode();
                snode.Name = skey;
                snode.Text = state.ToString();
                snode.Tag  = sid;
                treeConnect.BeginInvoke(new InvokeAddNode(AddNode), pnode, snode);
            }
        }
Example #7
0
        public override IoObject proto(IoState state)
        {
            IoCall pro = new IoCall();

            pro.state = state;
            pro.createSlots();
            pro.createProtos();
            state.registerProtoWithFunc(name, new IoStateProto(pro.name, pro, new IoStateProtoFunc(pro.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("sender", new IoMethodFunc(IoCall.slotSender)),
                new IoCFunction("target", new IoMethodFunc(IoCall.slotTarget)),
                new IoCFunction("message", new IoMethodFunc(IoCall.slotCallMessage)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return(pro);
        }
Example #8
0
        public List <ParkGate> QueryByParkingIdAndIoState(string parkingId, IoState ioState)
        {
            List <ParkGate> gatelist = new List <ParkGate>();
            StringBuilder   strSql   = new StringBuilder();

            strSql.Append("select g.* from ParkGate g");
            strSql.Append(" left join ParkBox b on g.BoxID=b.BoxID");
            strSql.Append(" left join ParkArea a on a.AreaID=b.AreaID");
            strSql.Append(" where a.PKID=@ParkingID and g.IoState=@IoState and g.DataStatus!=@DataStatus and a.DataStatus!=@DataStatus and b.DataStatus!=@DataStatus");
            using (DbOperator dbOperator = ConnectionManager.CreateReadConnection())
            {
                dbOperator.ClearParameters();
                dbOperator.AddParameter("ParkingID", parkingId);
                dbOperator.AddParameter("IoState", (int)ioState);
                dbOperator.AddParameter("DataStatus", (int)DataStatus.Delete);
                using (DbDataReader reader = dbOperator.ExecuteReader(strSql.ToString()))
                {
                    return(GetParkGates(reader));
                }
            }
        }
        public IResult Implement(ISynchronousContext context)
        {
            try
            {
                context.LogService.Info("Started restservice");

                string code = context.RequestBody;

                if (String.IsNullOrWhiteSpace(code))
                {
                    return(context.CreateErrorResult(500, "You must supply a body for the code"));
                }

                IoState state = new IoState();
                state.processBootstrap();

                IoObject returnValue = state.onDoCStringWithLabel(state.lobby, code.Trim(), "dotnet:");

                context.LogService.Info("Finished restservice");

                if (returnValue == null)
                {
                    return(context.CreateResult("Return value was null"));
                }

                if (returnValue is IoNumber)
                {
                    return(context.CreateResult((returnValue as IoNumber).asDouble()));
                }

                return(context.CreateResult(returnValue.ToString()));
            }
            catch (Exception e)
            {
                return(context.CreateErrorResult(500, e.Message));
            }
        }
Example #10
0
        public override IoObject proto(IoState state)
        {
            IoCall pro = new IoCall();
            pro.state = state;
            pro.createSlots();
            pro.createProtos();
            state.registerProtoWithFunc(name, new IoStateProto(pro.name, pro, new IoStateProtoFunc(pro.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("sender", new IoMethodFunc(IoCall.slotSender)),
                new IoCFunction("target", new IoMethodFunc(IoCall.slotTarget)),
                new IoCFunction("message", new IoMethodFunc(IoCall.slotCallMessage)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
Example #11
0
 public static new IoCall createProto(IoState state)
 {
     IoCall call = new IoCall();
     return call.proto(state) as IoCall;
 }
Example #12
0
 public static new IoCall createObject(IoState state)
 {
     IoCall call = new IoCall();
     return call.clone(state) as IoCall;
 }
Example #13
0
        public new static IoCall createObject(IoState state)
        {
            IoCall call = new IoCall();

            return(call.clone(state) as IoCall);
        }
Example #14
0
        public new static IoCall createProto(IoState state)
        {
            IoCall call = new IoCall();

            return(call.proto(state) as IoCall);
        }
Example #15
0
File: Program.cs Project: ypyf/io
        public static void Main(string[] args)
        {
            IoState state = new IoState();

            state.prompt(state);
        }