This is the sample program that can see the decode result of barcode data on Watson IoT.
Dependencies: AsciiFont DisplayApp GR-PEACH_video LCD_shield_config LWIPBP3595Interface_STA_for_mbed-os USBDevice
main.cpp
00001 /** 00002 * @file main.cpp 00003 * @brief mbed Endpoint Sample main 00004 * @author Doug Anson 00005 * @version 1.0 00006 * @see 00007 * 00008 * Copyright (c) 2014 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); 00011 * you may not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, 00018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 */ 00022 00023 // Our device type 00024 #define MY_DEVICE_TYPE "mbed-endpoint" 00025 00026 // Include security.h 00027 #include "security.h" 00028 00029 // mbed Endpoint Network 00030 #include "mbed-connector-interface/mbedEndpointNetwork.h" 00031 00032 // Logger 00033 #include "mbed-connector-interface/Logger.h" 00034 Serial pc(USBTX,USBRX); 00035 Logger logger(&pc); 00036 00037 // LED Resource 00038 #include "mbed-endpoint-resources/LEDResource.h" 00039 LEDResource led(&logger,"311","5850"); 00040 00041 // ZXing Resource 00042 #include "mbed-endpoint-resources/ZXingResource.h" 00043 ZXingResource barcodedecode(&logger,"888","7700",true); 00044 00045 // called from the Endpoint::start() below to create resources and the endpoint internals... 00046 Connector::Options *configure_endpoint(Connector::OptionsBuilder &config) 00047 { 00048 // Build the endpoint configuration parameters 00049 logger.logging("Endpoint::main (%s): customizing endpoint configuration...",net_get_type()); 00050 return config 00051 // PROVISIONING: set the Provisioning Credentials (all from security.h) 00052 .setEndpointNodename(MBED_ENDPOINT_NAME) 00053 .setDomain(MBED_DOMAIN) 00054 .setEndpointType(MY_DEVICE_TYPE) 00055 .setServerCertificate((uint8_t *)SERVER_CERT,(int)sizeof(SERVER_CERT)) 00056 .setClientCertificate((uint8_t *)CERT,(int)sizeof(CERT)) 00057 .setClientKey((uint8_t *)KEY,(int)sizeof(KEY)) 00058 00059 // Add my specific physical resources... 00060 .addResource(&led) 00061 .addResource(&barcodedecode,(bool)false) // on demand observation 00062 00063 // finalize the configuration... 00064 .build(); 00065 } 00066 00067 // main entry point... 00068 int main() 00069 { 00070 // set Serial 00071 pc.baud(115200); 00072 00073 // Announce 00074 logger.logging("\r\n\r\nmbed Connector Sample Endpoint - TechCon2016 (%s)",net_get_type()); 00075 00076 // we have to plumb our network first 00077 Connector::Endpoint::plumbNetwork(); 00078 00079 // starts the endpoint by finalizing its configuration (configure_endpoint() above gets called...) 00080 Connector::Endpoint::start(); 00081 }
Generated on Tue Jul 12 2022 18:38:05 by 1.7.2