| | |
| | | |
| | | if( !(str=iniparser_getstring(ini, "subsciber:subTopic", NULL)) ) |
| | | { |
| | | log_err("ERROR: Parser MQTT subscribe topic failure\n"); |
| | | return -2; |
| | | log_warn("WARNNING: Parser MQTT subscribe topic failure\n"); |
| | | } |
| | | strncpy(mqtt_ctx->subTopic, str, sizeof(mqtt_ctx->subTopic) ); |
| | | else |
| | | { |
| | | strncpy(mqtt_ctx->subTopic, str, sizeof(mqtt_ctx->subTopic) ); |
| | | mqtt_ctx->subQos = iniparser_getint(ini, "subsciber:subQos", 0); |
| | | mqtt_ctx->sub_enable = 1; |
| | | |
| | | mqtt_ctx->subQos = iniparser_getint(ini, "subsciber:subQos", 0); |
| | | log_nrml("Parser subscriber topic \"%s\" with Qos[%d]\n", mqtt_ctx->subTopic, mqtt_ctx->subQos); |
| | | mqtt_ctx->sub_enable = 1; |
| | | log_nrml("Parser subscriber topic \"%s\" with Qos[%d]\n", mqtt_ctx->subTopic, mqtt_ctx->subQos); |
| | | } |
| | | |
| | | /*+------------------------------------------------------+ |
| | | *| parser publisher settings | |
| | |
| | | |
| | | if( !(str=iniparser_getstring(ini, "publisher:pubTopic", NULL)) ) |
| | | { |
| | | log_err("ERROR: Parser MQTT publisher topic failure\n"); |
| | | return -2; |
| | | log_warn("WARNNING: Parser MQTT publisher topic failure\n"); |
| | | } |
| | | strncpy(mqtt_ctx->pubTopic, str, sizeof(mqtt_ctx->pubTopic) ); |
| | | else |
| | | { |
| | | strncpy(mqtt_ctx->pubTopic, str, sizeof(mqtt_ctx->pubTopic) ); |
| | | mqtt_ctx->pubQos = iniparser_getint(ini, "publisher:pubQos", 0); |
| | | mqtt_ctx->pub_enable = 1; |
| | | |
| | | mqtt_ctx->pubQos = iniparser_getint(ini, "publisher:pubQos", 0); |
| | | log_nrml("Parser publisher topic \"%s\" with Qos[%d]\n", mqtt_ctx->pubTopic, mqtt_ctx->pubQos); |
| | | mqtt_ctx->pub_enable = 1; |
| | | log_nrml("Parser publisher topic \"%s\" with Qos[%d]\n", mqtt_ctx->pubTopic, mqtt_ctx->pubQos); |
| | | } |
| | | |
| | | |
| | | return 0; |