当前位置: 首页>>代码示例>>C++>>正文


C++ Topic::itemIs方法代码示例

本文整理汇总了C++中Topic::itemIs方法的典型用法代码示例。如果您正苦于以下问题:C++ Topic::itemIs方法的具体用法?C++ Topic::itemIs怎么用?C++ Topic::itemIs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Topic的用法示例。


在下文中一共展示了Topic::itemIs方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: get

String WIFI::get(Topic &topic) {
  if (topic.itemIs(3, "macAddress")) {
    return macAddress();
  } else if (topic.itemIs(3, "scanResult")){
    return scanResult();
  } else {
    return TOPIC_NO;
  }
}
开发者ID:Pfannex,项目名称:ESP8266_Basic,代码行数:9,代码来源:WIFI.cpp

示例2: set

String WIFI::set(Topic &topic) {

  if (topic.itemIs(3, "scan")) {
    return scanWifi();
  } else {
    return TOPIC_NO;
  }
}
开发者ID:Pfannex,项目名称:ESP8266_Basic,代码行数:8,代码来源:WIFI.cpp

示例3: set

String customDevice::set(Topic &topic) {
  /*
  ~/set
  └─device             (level 2)
    └─deviceCFG        (level 3)
    └─index            (level 4) individual setting
    └─value            (level 4) individual setting
    └─scanBus          (level 4) scan 1W-Bus for new devices
*/


  logging.debug("device set topic " + topic.topic_asString() + " to " +
                topic.arg_asString());
  String ret = TOPIC_NO;

  if (topic.itemIs(3, "deviceCFG")) {
    //modify dashboard-------------------
    if (topic.itemIs(4, "addItem")) {
      modifyDashboard();
      return TOPIC_OK;
    }
  }
  return ret;
}
开发者ID:Pfannex,项目名称:ESP8266_Basic,代码行数:24,代码来源:customDevice.cpp

示例4: get

String customDevice::get(Topic &topic) {
  /*
  ~/get
  └─device             (level 2)
    └─sensor1          (level 3)
  */

  logging.debug("device get topic " + topic.topic_asString());

  if (topic.getItemCount() != 4) // ~/get/device/sensor1
    return TOPIC_NO;
  if (topic.itemIs(3, "sensor1")) {
    return String(measure());
  } else {
    return TOPIC_NO;
  }
}
开发者ID:Pfannex,项目名称:ESP8266_Basic,代码行数:17,代码来源:customDevice.cpp

示例5: set

String customDevice::set(Topic &topic) {
  /*
  ~/set
  └─device             (level 2)
    └─yourItem         (level 3)
  */

  logging.debug("device set topic " + topic.topic_asString() + " to " +
                topic.arg_asString());

  if (topic.getItemCount() != 4) // ~/set/device/yourItem
    return TOPIC_NO;
  if (topic.itemIs(3, "yourItem")) {
    return TOPIC_OK;
  } else {
    return TOPIC_NO;
  }
}
开发者ID:Pfannex,项目名称:ESP8266_Basic,代码行数:18,代码来源:customDevice.cpp

示例6: call

String Controller::call(Topic &topic) {

  // MQTT state information via API-call
  if (topic.modifyTopic(0) == "event/mqtt/connected") {
    if (topic.argIs(0, "1")) {
      on_mqtt_connected();
    } else {
      on_mqtt_disconnected();
    }
  }

  // D("Controller: begin call");
  // set
  if (topic.itemIs(1, "set")) {
    if (topic.itemIs(2, "ffs")) {
      return ffs.set(topic);
    } else if (topic.itemIs(2, "clock")) {
      return clock.set(topic);
    } else if (topic.itemIs(2, "esp")) {
      return espTools.set(topic);
    } else if (topic.itemIs(2, "wifi")) {
      return wifi.set(topic);
    } else if (topic.itemIs(2, "device")) {
      if (topic.itemIs(3, "fillDashboard")) {
        return device.fillDashboard();
      } else {
        return device.set(topic);
      }
    } else if (topic.itemIs(2, "controller")) {
      if (topic.itemIs(3, "reconnectDelay")) {
        D("set reconnectDelay");
        Di("arg=", topic.getArgAsLong(0));
        reconnectDelay = topic.getArgAsLong(0);
        if (reconnectDelay < 1)
          reconnectDelay = 1;
        if (reconnectDelay > RECONNECT_DELAY_MAX)
          reconnectDelay = RECONNECT_DELAY_MAX;
        reconnectDelayed = 0;
        return TOPIC_OK;
      } else {
        return TOPIC_NO;
      }
    } else {
      return TOPIC_NO;
    }
    // get
  } else if (topic.itemIs(1, "get")) {
    if (topic.itemIs(2, "ffs")) {
      return ffs.get(topic);
    } else if (topic.itemIs(2, "clock")) {
      return clock.get(topic);
    } else if (topic.itemIs(2, "esp")) {
      return espTools.get(topic);
    } else if (topic.itemIs(2, "wifi")) {
      return wifi.get(topic);
    } else if (topic.itemIs(2, "device")) {
      if(topic.itemIs(3, "flags")) {
        return fwConfig();
      } else if(topic.itemIs(3, "version")) {
        return device.getVersion();
      } else if (topic.itemIs(3, "type")) {
        return device.getType();
      } else if (topic.itemIs(3, "dashboard")) {
        return device.getDashboard();
      } else {
        return device.get(topic);
      }
    } else {
      return TOPIC_NO;
    }
  } else {
    return TOPIC_NO;
  }
  // D("Controller: end call");
}
开发者ID:Pfannex,项目名称:ESP8266_Basic,代码行数:75,代码来源:Controller.cpp


注:本文中的Topic::itemIs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。