示例#1
0
 public static string[] Action(IotAction action)
 {
     if (action.cmd == "hello")
     {
         return(GetAllItemName());
     }
     if (action.cmd == null || action.item == null)
     {
         return(null);
     }
     ActionByName(action);
     return(null);
 }
示例#2
0
 static void ActionByName(IotAction action)
 {
     for (int i = 0; i < maxIoT; i++)
     {
         if (IotItems[i] == null || IotItems[i].Name.Length == 0)
         {
             continue;
         }
         if (IotItems[i].Name == action.item)
         {
             try {
                 TotalActions++;
                 IotItems[i].IncrementActionCount();
                 IotItems[i].Action(action);
             }
             catch { _actionErrors++; }
             break;
         }
     }
 }