Send the data of GR-PEACH_HVC-P2_sample to the cloud.
Dependencies: AsciiFont GR-PEACH_video GraphicsFramework LCD_shield_config R_BSP USBHost_custom easy-connect-gr-peach
Fork of mbed-os-example-client by
Note at the time of sample import
Please not check the "Update all libraries to the latest version" at the time of import.
Warning!
When exporting and using it, increase the following stack size.
mbed-os/features/FEATURE_LWIP/lwip-interface/lwipopts.h
#define TCPIP_THREAD_STACKSIZE 1024 -> #define TCPIP_THREAD_STACKSIZE 2048
Overview
This is a sample to send the analysis result of GR-PEACH_HVC-P2_sample to the cloud using mbed-client. Please refer to following for operation of HVC-P2.
Import programGR-PEACH_HVC-P2_sample
Sample to operate omron HVC-P2 on GR-PEACH.
Required hardware
- GR-PEACH ( https://developer.mbed.org/platforms/Renesas-GR-PEACH/ )
- HVC-P2( https://developer.mbed.org/teams/Renesas/code/GR-PEACH_HVC-P2_sample/ )
- LCD Shield ( https://developer.mbed.org/teams/Renesas/wiki/LCD-shield )
- BP3595 ( https://developer.mbed.org/components/BP3595-for-GR-PEACH/ )
- Ethernet cable and connection to the internet
Application setup
Client credentials
To register the application to mbed Device Connector, you need to create and set the client side certificate.
- Go to https://connector.mbed.com/ and log in with your mbed account
- On mbed Device Connector, go to https://connector.mbed.com/#credentials and click the Get my device security credentials button to get new credentials for your device.
- Replace the contents in security.h of this example with content copied above.
Ethernet settings
This sample uses Ethernet as the default connection type. To change the connection type, set WIFI_BP3595 in mbed_app.json:
mbed_app.json
"network-interface":{ "help": "Options are ETHERNET, WIFI_ESP8266, WIFI_BP3595", "value": "ETHERNET" },
To specify MAC address, add fllowing function to main.cpp. (When using Wifi, setting of MAC address is not necessary.)
Specify MAC address
// set mac address void mbed_mac_address(char *mac) { mac[0] = 0x00; mac[1] = 0x02; mac[2] = 0xF7; mac[3] = 0xF0; mac[4] = 0x00; mac[5] = 0x00; }
Wifi settings
This example can use BP3595 Wifi Interface for managing the wireless connectivity. To run this example using Wifi, you need:
- A BP3595 Wifi module ( https://developer.mbed.org/components/BP3595-for-GR-PEACH/ )
- Mount BP3595 onto GR-PEACH
- Close GR-PEACH's JP21 (https://developer.mbed.org/teams/Renesas/wiki/Jumper-settings-of-GR-PEACH)
- In the mbed_app.json file, change
mbed_app.json
"network-interface":{ "help": "Options are ETHERNET, WIFI_ESP8266, WIFI_BP3595", "value": "WIFI_BP3595" },
Provide your Wifi SSID and password here and leave \" in the beginning and end of your SSID and password as shown in the example below:
mbed_app.json
"wifi-ssid": { "help": "WiFi SSID", "value": "\"SSID\"" }, "wifi-password": { "help": "WIFI Password", "value": "\"Password\"" }
Specify the security type for connection to be used. When the security type is WPA2, you need to specify
NSAPI_SECURITY_WAP as follows:
mbed_app.json
"wifi-security":{ "help": "Options are NSAPI_SECURITY_WEP, NSAPI_SECURITY_WPA, NSAPI_SECURITY_WPA2, NSAPI_SECURITY_WPA_WPA2", "value": "NSAPI_SECURITY_WEP" },
By default, NSAPI_SECURITY_WPA_WPA2 is specified here.
Application resources
This example exposes four resources listed below:
- 3202/0/5700. Recognition result from HVC-P2 (GET).
- 3201/0/5850. Blink function, blinks LED when executed (POST).
- 3201/0/5853. Blink pattern, used by the blink function to determine how to blink. In the format of 1000:500:1000:500:1000:500 (PUT).
- 3201/0/5855. Blink color, used by the blink function. Any of red, green, blue, cyan, yellow and magenta is acceptable (PUT).
For more info on how to get notifications when resource 1 changes, or how to use resource 2, 3 and 4, please look at
Import programGR-PEACH_mbed-connector-ZXingSample-node
Node.js based Web Application for mbed Device Connector specific to GR-PEACH_mbed-os-client-ZXingSample
# This is a Web Application for GR-PEACH_mbed-os-client-ZXingSample, but it can also be used for this sample.
HVCApi/HVCApi.h@73:fbc0212c2eaf, 2017-03-14 (annotated)
- Committer:
- dkato
- Date:
- Tue Mar 14 05:43:50 2017 +0000
- Revision:
- 73:fbc0212c2eaf
Send the data of GR-PEACH_HVC-P2_sample to the cloud.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dkato | 73:fbc0212c2eaf | 1 | /*---------------------------------------------------------------------------*/ |
dkato | 73:fbc0212c2eaf | 2 | /* Copyright(C) 2017 OMRON Corporation */ |
dkato | 73:fbc0212c2eaf | 3 | /* */ |
dkato | 73:fbc0212c2eaf | 4 | /* Licensed under the Apache License, Version 2.0 (the "License"); */ |
dkato | 73:fbc0212c2eaf | 5 | /* you may not use this file except in compliance with the License. */ |
dkato | 73:fbc0212c2eaf | 6 | /* You may obtain a copy of the License at */ |
dkato | 73:fbc0212c2eaf | 7 | /* */ |
dkato | 73:fbc0212c2eaf | 8 | /* http://www.apache.org/licenses/LICENSE-2.0 */ |
dkato | 73:fbc0212c2eaf | 9 | /* */ |
dkato | 73:fbc0212c2eaf | 10 | /* Unless required by applicable law or agreed to in writing, software */ |
dkato | 73:fbc0212c2eaf | 11 | /* distributed under the License is distributed on an "AS IS" BASIS, */ |
dkato | 73:fbc0212c2eaf | 12 | /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ |
dkato | 73:fbc0212c2eaf | 13 | /* See the License for the specific language governing permissions and */ |
dkato | 73:fbc0212c2eaf | 14 | /* limitations under the License. */ |
dkato | 73:fbc0212c2eaf | 15 | /*---------------------------------------------------------------------------*/ |
dkato | 73:fbc0212c2eaf | 16 | |
dkato | 73:fbc0212c2eaf | 17 | /* |
dkato | 73:fbc0212c2eaf | 18 | HVC Sample API |
dkato | 73:fbc0212c2eaf | 19 | */ |
dkato | 73:fbc0212c2eaf | 20 | |
dkato | 73:fbc0212c2eaf | 21 | #ifndef HVCApi_H__ |
dkato | 73:fbc0212c2eaf | 22 | #define HVCApi_H__ |
dkato | 73:fbc0212c2eaf | 23 | |
dkato | 73:fbc0212c2eaf | 24 | #ifndef UINT8 |
dkato | 73:fbc0212c2eaf | 25 | typedef unsigned char UINT8; /* 8 bit Unsigned Integer */ |
dkato | 73:fbc0212c2eaf | 26 | #endif /* UINT8 */ |
dkato | 73:fbc0212c2eaf | 27 | #ifndef INT32 |
dkato | 73:fbc0212c2eaf | 28 | typedef int INT32; /* 32 bit Signed Integer */ |
dkato | 73:fbc0212c2eaf | 29 | #endif /* INT32 */ |
dkato | 73:fbc0212c2eaf | 30 | #ifndef NULL |
dkato | 73:fbc0212c2eaf | 31 | #define NULL 0 |
dkato | 73:fbc0212c2eaf | 32 | #endif |
dkato | 73:fbc0212c2eaf | 33 | |
dkato | 73:fbc0212c2eaf | 34 | #include "HVCDef.h" |
dkato | 73:fbc0212c2eaf | 35 | |
dkato | 73:fbc0212c2eaf | 36 | #ifdef __cplusplus |
dkato | 73:fbc0212c2eaf | 37 | extern "C" { |
dkato | 73:fbc0212c2eaf | 38 | #endif |
dkato | 73:fbc0212c2eaf | 39 | |
dkato | 73:fbc0212c2eaf | 40 | /* HVC_GetVersion */ |
dkato | 73:fbc0212c2eaf | 41 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 42 | /* : HVC_VERSION *outVersion version data */ |
dkato | 73:fbc0212c2eaf | 43 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 44 | INT32 HVC_GetVersion(INT32 inTimeOutTime, HVC_VERSION *outVersion, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 45 | |
dkato | 73:fbc0212c2eaf | 46 | /* HVC_SetCameraAngle */ |
dkato | 73:fbc0212c2eaf | 47 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 48 | /* : INT32 inAngleNo camera angle number */ |
dkato | 73:fbc0212c2eaf | 49 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 50 | INT32 HVC_SetCameraAngle(INT32 inTimeOutTime, INT32 inAngleNo, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 51 | |
dkato | 73:fbc0212c2eaf | 52 | /* HVC_GetCameraAngle */ |
dkato | 73:fbc0212c2eaf | 53 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 54 | /* : INT32 *outAngleNo camera angle number */ |
dkato | 73:fbc0212c2eaf | 55 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 56 | INT32 HVC_GetCameraAngle(INT32 inTimeOutTime, INT32 *outAngleNo, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 57 | |
dkato | 73:fbc0212c2eaf | 58 | /* HVC_Execute */ |
dkato | 73:fbc0212c2eaf | 59 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 60 | /* : INT32 inExec executable function */ |
dkato | 73:fbc0212c2eaf | 61 | /* : INT32 inImage image output number */ |
dkato | 73:fbc0212c2eaf | 62 | /* : HVC_RESULT *outHVCResult result data */ |
dkato | 73:fbc0212c2eaf | 63 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 64 | INT32 HVC_Execute(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 65 | |
dkato | 73:fbc0212c2eaf | 66 | /* HVC_ExecuteEx */ |
dkato | 73:fbc0212c2eaf | 67 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 68 | /* : INT32 inExec executable function */ |
dkato | 73:fbc0212c2eaf | 69 | /* : INT32 inImage image output number */ |
dkato | 73:fbc0212c2eaf | 70 | /* : HVC_RESULT *outHVCResult result data */ |
dkato | 73:fbc0212c2eaf | 71 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 72 | INT32 HVC_ExecuteEx(INT32 inTimeOutTime, INT32 inExec, INT32 inImage, HVC_RESULT *outHVCResult, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 73 | |
dkato | 73:fbc0212c2eaf | 74 | /* HVC_SetThreshold */ |
dkato | 73:fbc0212c2eaf | 75 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 76 | /* : HVC_THRESHOLD *inThreshold threshold values */ |
dkato | 73:fbc0212c2eaf | 77 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 78 | INT32 HVC_SetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *inThreshold, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 79 | |
dkato | 73:fbc0212c2eaf | 80 | /* HVC_GetThreshold */ |
dkato | 73:fbc0212c2eaf | 81 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 82 | /* : HVC_THRESHOLD *outThreshold threshold values */ |
dkato | 73:fbc0212c2eaf | 83 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 84 | INT32 HVC_GetThreshold(INT32 inTimeOutTime, HVC_THRESHOLD *outThreshold, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 85 | |
dkato | 73:fbc0212c2eaf | 86 | /* HVC_SetSizeRange */ |
dkato | 73:fbc0212c2eaf | 87 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 88 | /* : HVC_SIZERANGE *inSizeRange detection sizes */ |
dkato | 73:fbc0212c2eaf | 89 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 90 | INT32 HVC_SetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *inSizeRange, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 91 | |
dkato | 73:fbc0212c2eaf | 92 | /* HVC_GetSizeRange */ |
dkato | 73:fbc0212c2eaf | 93 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 94 | /* : HVC_SIZERANGE *outSizeRange detection sizes */ |
dkato | 73:fbc0212c2eaf | 95 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 96 | INT32 HVC_GetSizeRange(INT32 inTimeOutTime, HVC_SIZERANGE *outSizeRange, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 97 | |
dkato | 73:fbc0212c2eaf | 98 | /* HVC_SetFaceDetectionAngle */ |
dkato | 73:fbc0212c2eaf | 99 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 100 | /* : INT32 inPose Yaw angle range */ |
dkato | 73:fbc0212c2eaf | 101 | /* : INT32 inAngle Roll angle range */ |
dkato | 73:fbc0212c2eaf | 102 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 103 | INT32 HVC_SetFaceDetectionAngle(INT32 inTimeOutTime, INT32 inPose, INT32 inAngle, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 104 | |
dkato | 73:fbc0212c2eaf | 105 | /* HVC_GetFaceDetectionAngle */ |
dkato | 73:fbc0212c2eaf | 106 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 107 | /* : INT32 *outPose Yaw angle range */ |
dkato | 73:fbc0212c2eaf | 108 | /* : INT32 *outAngle Roll angle range */ |
dkato | 73:fbc0212c2eaf | 109 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 110 | INT32 HVC_GetFaceDetectionAngle(INT32 inTimeOutTime, INT32 *outPose, INT32 *outAngle, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 111 | |
dkato | 73:fbc0212c2eaf | 112 | /* HVC_SetBaudRate */ |
dkato | 73:fbc0212c2eaf | 113 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 114 | /* : INT32 inRate Baudrate */ |
dkato | 73:fbc0212c2eaf | 115 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 116 | INT32 HVC_SetBaudRate(INT32 inTimeOutTime, INT32 inRate, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 117 | |
dkato | 73:fbc0212c2eaf | 118 | /* HVC_Registration */ |
dkato | 73:fbc0212c2eaf | 119 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 120 | /* : INT32 inUserID User ID (0-499) */ |
dkato | 73:fbc0212c2eaf | 121 | /* : INT32 inDataID Data ID (0-9) */ |
dkato | 73:fbc0212c2eaf | 122 | /* : HVC_IMAGE *outImage image info */ |
dkato | 73:fbc0212c2eaf | 123 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 124 | INT32 HVC_Registration(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, HVC_IMAGE *outImage, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 125 | |
dkato | 73:fbc0212c2eaf | 126 | /* HVC_DeleteData */ |
dkato | 73:fbc0212c2eaf | 127 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 128 | /* : INT32 inUserID User ID (0-499) */ |
dkato | 73:fbc0212c2eaf | 129 | /* : INT32 inDataID Data ID (0-9) */ |
dkato | 73:fbc0212c2eaf | 130 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 131 | INT32 HVC_DeleteData(INT32 inTimeOutTime, INT32 inUserID, INT32 inDataID, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 132 | |
dkato | 73:fbc0212c2eaf | 133 | /* HVC_DeleteUser */ |
dkato | 73:fbc0212c2eaf | 134 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 135 | /* : INT32 inUserID User ID (0-499) */ |
dkato | 73:fbc0212c2eaf | 136 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 137 | INT32 HVC_DeleteUser(INT32 inTimeOutTime, INT32 inUserID, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 138 | |
dkato | 73:fbc0212c2eaf | 139 | /* HVC_DeleteAll */ |
dkato | 73:fbc0212c2eaf | 140 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 141 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 142 | INT32 HVC_DeleteAll(INT32 inTimeOutTime, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 143 | |
dkato | 73:fbc0212c2eaf | 144 | /* HVC_GetUserData */ |
dkato | 73:fbc0212c2eaf | 145 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 146 | /* : INT32 inUserID User ID (0-499) */ |
dkato | 73:fbc0212c2eaf | 147 | /* : INT32 *outDataNo Registration Info */ |
dkato | 73:fbc0212c2eaf | 148 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 149 | INT32 HVC_GetUserData(INT32 inTimeOutTime, INT32 inUserID, INT32 *outDataNo, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 150 | |
dkato | 73:fbc0212c2eaf | 151 | /* HVC_SaveAlbum */ |
dkato | 73:fbc0212c2eaf | 152 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 153 | /* : UINT8 *outAlbumData Album data */ |
dkato | 73:fbc0212c2eaf | 154 | /* : INT32 *outAlbumDataSize Album data size */ |
dkato | 73:fbc0212c2eaf | 155 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 156 | INT32 HVC_SaveAlbum(INT32 inTimeOutTime, UINT8 *outAlbumData, INT32 *outAlbumDataSize, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 157 | |
dkato | 73:fbc0212c2eaf | 158 | /* HVC_LoadAlbum */ |
dkato | 73:fbc0212c2eaf | 159 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 160 | /* : UINT8 *inAlbumData Album data */ |
dkato | 73:fbc0212c2eaf | 161 | /* : INT32 inAlbumDataSize Album data size */ |
dkato | 73:fbc0212c2eaf | 162 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 163 | INT32 HVC_LoadAlbum(INT32 inTimeOutTime, UINT8 *inAlbumData, INT32 inAlbumDataSize, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 164 | |
dkato | 73:fbc0212c2eaf | 165 | /* HVC_WriteAlbum */ |
dkato | 73:fbc0212c2eaf | 166 | /* param : INT32 inTimeOutTime timeout time (ms) */ |
dkato | 73:fbc0212c2eaf | 167 | /* : UINT8 *outStatus response code */ |
dkato | 73:fbc0212c2eaf | 168 | INT32 HVC_WriteAlbum(INT32 inTimeOutTime, UINT8 *outStatus); |
dkato | 73:fbc0212c2eaf | 169 | |
dkato | 73:fbc0212c2eaf | 170 | #ifdef __cplusplus |
dkato | 73:fbc0212c2eaf | 171 | } |
dkato | 73:fbc0212c2eaf | 172 | #endif |
dkato | 73:fbc0212c2eaf | 173 | |
dkato | 73:fbc0212c2eaf | 174 | #endif /* HVCApi_H__ */ |