Door controller and proximity switch detection.

Dependencies:   mbed-rtos mbed VodafoneUSBModem_bleedingedge

This program takes in a digital input - which is a reed switch for a door - and an output to a relay. The door is open with a simple 'text' to the modem on the USB bus (i used k3770 vodafone dongle).

The door will send an alarm message to your nominated numbers at the start of the program if the door is open without a command being sent.

Very simple - and just meant as a demonstration of how to incorporate GSM/3G functionality to a evice.

Committer:
nherriot
Date:
Sun Feb 10 16:32:32 2013 +0000
Revision:
23:28b693d586ee
Parent:
22:87d73be30243
Child:
26:b9a0fa0f2469
small dbg changes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nherriot 0:5136cdfaebd0 1 /* net_sms_test.cpp */
nherriot 0:5136cdfaebd0 2 /*
nherriot 0:5136cdfaebd0 3 Copyright (C) 2012 ARM Limited.
nherriot 0:5136cdfaebd0 4
nherriot 0:5136cdfaebd0 5 Permission is hereby granted, free of charge, to any person obtaining a copy of
nherriot 0:5136cdfaebd0 6 this software and associated documentation files (the "Software"), to deal in
nherriot 0:5136cdfaebd0 7 the Software without restriction, including without limitation the rights to
nherriot 0:5136cdfaebd0 8 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
nherriot 0:5136cdfaebd0 9 of the Software, and to permit persons to whom the Software is furnished to do
nherriot 0:5136cdfaebd0 10 so, subject to the following conditions:
nherriot 0:5136cdfaebd0 11
nherriot 0:5136cdfaebd0 12 The above copyright notice and this permission notice shall be included in all
nherriot 0:5136cdfaebd0 13 copies or substantial portions of the Software.
nherriot 0:5136cdfaebd0 14
nherriot 0:5136cdfaebd0 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
nherriot 0:5136cdfaebd0 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
nherriot 0:5136cdfaebd0 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
nherriot 0:5136cdfaebd0 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
nherriot 0:5136cdfaebd0 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
nherriot 0:5136cdfaebd0 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
nherriot 0:5136cdfaebd0 21 SOFTWARE.
nherriot 0:5136cdfaebd0 22 */
nherriot 0:5136cdfaebd0 23
nherriot 0:5136cdfaebd0 24 #define __DEBUG__ 4 //Maximum verbosity
nherriot 0:5136cdfaebd0 25 #ifndef __MODULE__
nherriot 6:5a892c3d738e 26 // #define __MODULE__ "net_voda_k3770_test.cpp"
nherriot 0:5136cdfaebd0 27 #endif
nherriot 0:5136cdfaebd0 28
nherriot 22:87d73be30243 29 #define MY_PHONE_NUMBER "+447717275049" // Nicholas' Number
nherriot 22:87d73be30243 30 #define BACKUP_NUMBER "+447825608771" // Ashleys Number
nherriot 0:5136cdfaebd0 31
nherriot 0:5136cdfaebd0 32 #include "core/fwk.h"
nherriot 0:5136cdfaebd0 33 #include "mbed.h"
nherriot 0:5136cdfaebd0 34 #include "rtos.h"
nherriot 10:c8a6f2822068 35 #include "VodafoneUSBModem.h"
nherriot 0:5136cdfaebd0 36
nherriot 2:bcc9256ecaab 37 #include <string>
nherriot 2:bcc9256ecaab 38
nherriot 0:5136cdfaebd0 39 extern "C" void HardFault_Handler() {
nherriot 0:5136cdfaebd0 40 error("Hard Fault!\n");
nherriot 0:5136cdfaebd0 41 }
nherriot 0:5136cdfaebd0 42
nherriot 8:1b4e84f4c451 43 DigitalOut led1(LED1); // LED 1 is used to show the state of the door. ON is door open, and OFF is door close.
nherriot 16:9245c3a37491 44 DigitalOut led2(LED2); // LED 2 is used to indicate that the main process is still running.
nherriot 8:1b4e84f4c451 45 DigitalOut led3(LED3); // LED 3 is use to indicate if the relay is being switched on to open the door
nherriot 22:87d73be30243 46 DigitalOut led4(LED4); // LED 4 indicate the state of the ALARM - If it's on the door is armed.
nherriot 8:1b4e84f4c451 47 DigitalOut doorContactorRelay(p5); // create a digital pin object to control the door contactor relay
nherriot 11:769f2b28b236 48 DigitalIn doorProximitySwitch(p6); // create a digital pin object to sense door position proximity switch, this works in reverse
nherriot 8:1b4e84f4c451 49 // the switch senses positive when the door is closed - need to be sure when it's closed! :-)
nherriot 8:1b4e84f4c451 50 bool openTheDoor = false; // create a state variable which is set to indicate the mbed should open the door
nherriot 8:1b4e84f4c451 51 // this variable will be used hold the latch open until it knows the door has been open.
nherriot 15:262da03e3e20 52 bool detectRegState = true; // this boolean variable will force the while loop to detect reg state - if the connection manager
nherriot 22:87d73be30243 53 // is not registered it will stay in this 'detec' phase for ever.
nherriot 22:87d73be30243 54 bool alarmActive = false; // this alarm flag will only be true if the door is open - but no signal has been detected
nherriot 22:87d73be30243 55 // to open the door. in other words there is a break in!
nherriot 22:87d73be30243 56 bool closeTheDoor = false; // this flag is used when the door is in an open legal state. once it's closed after a legal state
nherriot 22:87d73be30243 57 // it will set the alarm to active.
nherriot 22:87d73be30243 58
nherriot 22:87d73be30243 59
nherriot 10:c8a6f2822068 60 int read_digital(void) {
nherriot 10:c8a6f2822068 61 DigitalIn mydigital(p6);
nherriot 10:c8a6f2822068 62 return(mydigital.read());
nherriot 10:c8a6f2822068 63 }
nherriot 0:5136cdfaebd0 64
nherriot 0:5136cdfaebd0 65 void test(void const*) {
nherriot 0:5136cdfaebd0 66
nherriot 22:87d73be30243 67 DBG("Hello world and Vodafone Connection Manager test program!");
nherriot 22:87d73be30243 68 DBG("Waiting 30 seconds for modem to settle down");
nherriot 23:28b693d586ee 69 Thread::wait(10000);
nherriot 23:28b693d586ee 70 VodafoneUSBModem connectionManager; // create a connection manager object
nherriot 0:5136cdfaebd0 71
nherriot 10:c8a6f2822068 72 char num[17]; // create a buffer to hold the telephone number in
nherriot 10:c8a6f2822068 73 char msg[160]; // create a buffer to hold the text message in
nherriot 10:c8a6f2822068 74 size_t count;
nherriot 15:262da03e3e20 75 LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN; // an enum to hold the registration state of the connection manager
nherriot 15:262da03e3e20 76 LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN; // an enum to hold the type of bearer established by the connection manager
nherriot 15:262da03e3e20 77 int rssi = -1000; // a signal strength indicator variable - set to a very default low value.
nherriot 15:262da03e3e20 78
nherriot 22:87d73be30243 79 // this is a fudge to let the modem settle down - we wait for 30 seconds
nherriot 23:28b693d586ee 80
nherriot 22:87d73be30243 81 DBG("Wait over - initialising the modem manager");
nherriot 23:28b693d586ee 82
nherriot 23:28b693d586ee 83
nherriot 23:28b693d586ee 84
nherriot 17:9b57d29e2eab 85 int ret = connectionManager.getLinkState(&rssi, &regState, &bearer);
nherriot 16:9245c3a37491 86 // LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_HOME_NETWORK;
nherriot 16:9245c3a37491 87
nherriot 15:262da03e3e20 88 // before we do anything we need to make sure we have a connection to a network.
nherriot 15:262da03e3e20 89 // so let us check that first!
nherriot 15:262da03e3e20 90
nherriot 16:9245c3a37491 91
nherriot 15:262da03e3e20 92 while(detectRegState)
nherriot 15:262da03e3e20 93 {
nherriot 17:9b57d29e2eab 94 if (detectRegState ==1)
nherriot 15:262da03e3e20 95 {
nherriot 15:262da03e3e20 96 if(rssi==-1000)
nherriot 15:262da03e3e20 97 {
nherriot 15:262da03e3e20 98 DBG("Checking signal strength - RSSI: Error.");
nherriot 15:262da03e3e20 99 }
nherriot 15:262da03e3e20 100 else
nherriot 15:262da03e3e20 101 {
nherriot 15:262da03e3e20 102 DBG("Signal strength is: RSSI: %d",rssi);
nherriot 15:262da03e3e20 103 }
nherriot 15:262da03e3e20 104
nherriot 15:262da03e3e20 105 switch(regState)
nherriot 15:262da03e3e20 106 {
nherriot 15:262da03e3e20 107 case LinkMonitor::REGISTRATION_STATE_UNKNOWN:
nherriot 15:262da03e3e20 108 DBG("regState: UNKNOWN. Failing.");
nherriot 15:262da03e3e20 109 break;
nherriot 15:262da03e3e20 110 case LinkMonitor::REGISTRATION_STATE_REGISTERING:
nherriot 15:262da03e3e20 111 DBG("regState: REGISTERING");
nherriot 15:262da03e3e20 112 break;
nherriot 15:262da03e3e20 113 case LinkMonitor::REGISTRATION_STATE_DENIED:
nherriot 15:262da03e3e20 114 DBG("regState: DENIED");
nherriot 15:262da03e3e20 115 break;
nherriot 15:262da03e3e20 116 case LinkMonitor::REGISTRATION_STATE_NO_SIGNAL:
nherriot 15:262da03e3e20 117 DBG("regState: NO SIGNAL");
nherriot 15:262da03e3e20 118 break;
nherriot 23:28b693d586ee 119 case HARDWARE_NO_RESPONSE:
nherriot 23:28b693d586ee 120 DBG("Looks like there is no modem inserted, or power to the modem module has failed?");
nherriot 23:28b693d586ee 121 break;
nherriot 15:262da03e3e20 122 case LinkMonitor::REGISTRATION_STATE_HOME_NETWORK:
nherriot 15:262da03e3e20 123 detectRegState = false;
nherriot 15:262da03e3e20 124 DBG("regState: HOME NETWORK");
nherriot 15:262da03e3e20 125 break;
nherriot 15:262da03e3e20 126 case LinkMonitor::REGISTRATION_STATE_ROAMING:
nherriot 15:262da03e3e20 127 detectRegState = false;
nherriot 15:262da03e3e20 128 DBG("regState: ROAMING");
nherriot 15:262da03e3e20 129 break;
nherriot 15:262da03e3e20 130 default:
nherriot 15:262da03e3e20 131 DBG("regState: ERROR. Failing.");
nherriot 17:9b57d29e2eab 132
nherriot 15:262da03e3e20 133 }
nherriot 15:262da03e3e20 134 }
nherriot 16:9245c3a37491 135 Thread::wait(500);
nherriot 23:28b693d586ee 136 int ret = connectionManager.getLinkState(&rssi, &regState, &bearer);
nherriot 15:262da03e3e20 137 }
nherriot 15:262da03e3e20 138
nherriot 22:87d73be30243 139 // let the boss man know I'm alive and entering my main loop
nherriot 22:87d73be30243 140 ret = connectionManager.sendSM(MY_PHONE_NUMBER, "Hello from Vodafone door controller 2013 - Alarm Active");
nherriot 22:87d73be30243 141 ret = connectionManager.sendSM(BACKUP_NUMBER, "Hello from Vodafone door controller 2013- Alarm Active");
nherriot 22:87d73be30243 142
nherriot 22:87d73be30243 143 // better let the boss know that I'm on a roamed network as this could cost some money! or present some routing problems
nherriot 22:87d73be30243 144 if (regState==LinkMonitor::REGISTRATION_STATE_ROAMING)
nherriot 22:87d73be30243 145 {
nherriot 22:87d73be30243 146 //ret = connectionManager.sendSM(MY_PHONE_NUMBER, "Warning sir - I'm on a roamed network!");
nherriot 22:87d73be30243 147 ret = connectionManager.sendSM(BACKUP_NUMBER, "Warning sir - I'm on a roamed network!");
nherriot 22:87d73be30243 148 }
nherriot 22:87d73be30243 149
nherriot 10:c8a6f2822068 150
nherriot 0:5136cdfaebd0 151 while(true)
nherriot 0:5136cdfaebd0 152 {
nherriot 8:1b4e84f4c451 153
nherriot 8:1b4e84f4c451 154 // if this state variable has been set I need to keep the doorContactor on until the door is open
nherriot 15:262da03e3e20 155 if ((openTheDoor) && (read_digital() == 0))
nherriot 3:0a8eebcb0acf 156 {
nherriot 15:262da03e3e20 157 DBG("The door is open now and I'm switching off the relay and reseting the state variable");
nherriot 8:1b4e84f4c451 158 doorContactorRelay = 0; // door must be open now so switch relay off.
nherriot 8:1b4e84f4c451 159 openTheDoor = false; // the door is open now so set it to false.
nherriot 8:1b4e84f4c451 160 led3 = 0; // switch the LED light off to indicate I'm switching the relay off
nherriot 22:87d73be30243 161 closeTheDoor = true; // now set the flag to indicate we are waiting for a closed door event allowing us to then activate the alarm
nherriot 22:87d73be30243 162 DBG("The closeTheDoor is now set to TRUE");
nherriot 8:1b4e84f4c451 163
nherriot 8:1b4e84f4c451 164 }
nherriot 3:0a8eebcb0acf 165
nherriot 22:87d73be30243 166 if ((read_digital() != 0) && ( closeTheDoor == true))
nherriot 22:87d73be30243 167 {
nherriot 22:87d73be30243 168 closeTheDoor = false; // the door is now closed after a legal open so reset the flag
nherriot 22:87d73be30243 169 alarmActive = true; // OK we can now activate the ALARM again
nherriot 22:87d73be30243 170 led4 = 1; // switch the alarm light on
nherriot 22:87d73be30243 171 DBG("The door is now closed after an open and the ALARM is no re-activated");
nherriot 22:87d73be30243 172
nherriot 22:87d73be30243 173 }
nherriot 22:87d73be30243 174
nherriot 22:87d73be30243 175 // check to see if the door is open and the alarm is on - if it is send warning message - but just once!!!!
nherriot 22:87d73be30243 176 if ((read_digital() == 0) && (alarmActive == true))
nherriot 22:87d73be30243 177 {
nherriot 22:87d73be30243 178 DBG("The door is now open - but the ALARM is active - send emergency text to warn our boss!");
nherriot 22:87d73be30243 179 DBG("*******************************************************************");
nherriot 22:87d73be30243 180 DBG("WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING");
nherriot 22:87d73be30243 181 DBG("*******************************************************************");
nherriot 22:87d73be30243 182 alarmActive = false; // set the alarm off as we don't want to keep sending text messages
nherriot 22:87d73be30243 183 led4 = 0; // set the alarm light to off
nherriot 22:87d73be30243 184 connectionManager.sendSM(BACKUP_NUMBER, "ALARM - ALARM - ALARM - Your door is open but I've not received an 'open' command!!!" );
nherriot 22:87d73be30243 185 connectionManager.sendSM(MY_PHONE_NUMBER, "ALARM - ALARM - ALARM - Your door is open but I've not received an 'open' command!!!" );
nherriot 22:87d73be30243 186
nherriot 22:87d73be30243 187 }
nherriot 22:87d73be30243 188
nherriot 22:87d73be30243 189 // check to see that the door is closed and the alarm can be reset. this will happen if the openTheDoor state variable
nherriot 22:87d73be30243 190 // is FALSE (indicating that the system is not trying to hold the relay open to allow accesss, the door is closed and the ALARM is false
nherriot 22:87d73be30243 191 if ((openTheDoor == false) && (read_digital() !=0) && (alarmActive == false))
nherriot 22:87d73be30243 192 {
nherriot 22:87d73be30243 193 DBG("Resetting the ALARM to active again");
nherriot 22:87d73be30243 194 alarmActive = true; // set the alarm on as the door is closed again
nherriot 22:87d73be30243 195 led4 = 1;
nherriot 22:87d73be30243 196 }
nherriot 22:87d73be30243 197
nherriot 22:87d73be30243 198
nherriot 8:1b4e84f4c451 199 // check the state of the door and switch the LED light to 'ON' for door open and 'OFF' for door closed.
nherriot 10:c8a6f2822068 200 //if (doorProximitySwitch.read() == 0)
nherriot 10:c8a6f2822068 201 if (read_digital() == 0)
nherriot 8:1b4e84f4c451 202 {
nherriot 15:262da03e3e20 203 // DBG("The door proximity switch is: %d so I think it's open", doorProximitySwitch.read() );
nherriot 8:1b4e84f4c451 204 led1 = 1;
nherriot 3:0a8eebcb0acf 205 }
nherriot 8:1b4e84f4c451 206 else
nherriot 8:1b4e84f4c451 207 {
nherriot 15:262da03e3e20 208 // DBG("The door proximity switch is: %d so I think it's closed", doorProximitySwitch.read() );
nherriot 8:1b4e84f4c451 209 led1 = 0;
nherriot 8:1b4e84f4c451 210 }
nherriot 8:1b4e84f4c451 211
nherriot 8:1b4e84f4c451 212
nherriot 8:1b4e84f4c451 213
nherriot 7:316c2dac06a5 214 int ret = connectionManager.getSMCount(&count); // check to see if there is an incoming SMS message
nherriot 0:5136cdfaebd0 215 if(ret)
nherriot 0:5136cdfaebd0 216 {
nherriot 0:5136cdfaebd0 217 WARN("getSMCount returned %d", ret);
nherriot 10:c8a6f2822068 218 Thread::wait(125);
nherriot 0:5136cdfaebd0 219 continue;
nherriot 0:5136cdfaebd0 220 }
nherriot 10:c8a6f2822068 221
nherriot 23:28b693d586ee 222 // DBG("The SMS count is now at: %d for this modem", count);
nherriot 7:316c2dac06a5 223 if( count > 0) // if there are messages in the mailbox start pulling them off the queue
nherriot 0:5136cdfaebd0 224 {
nherriot 0:5136cdfaebd0 225 DBG("%d SMS to read", count);
nherriot 10:c8a6f2822068 226 ret = connectionManager.getSM(num, msg, 160);
nherriot 8:1b4e84f4c451 227
nherriot 0:5136cdfaebd0 228 if(ret)
nherriot 0:5136cdfaebd0 229 {
nherriot 0:5136cdfaebd0 230 WARN("getSM returned %d", ret);
nherriot 10:c8a6f2822068 231 Thread::wait(125);
nherriot 0:5136cdfaebd0 232 continue;
nherriot 0:5136cdfaebd0 233 }
nherriot 0:5136cdfaebd0 234
nherriot 6:5a892c3d738e 235 DBG("The message is from number: %s and the message is: \"%s\"", num, msg);
nherriot 6:5a892c3d738e 236
nherriot 15:262da03e3e20 237 // if the SMS is from your own number, ignore it!
nherriot 15:262da03e3e20 238 if(strcmp(num,"+447785666088")==0)
nherriot 15:262da03e3e20 239 {
nherriot 15:262da03e3e20 240 DBG("The message appears to be from my MSISDN number: %s, I'll do nothing.", num);
nherriot 15:262da03e3e20 241 continue;
nherriot 15:262da03e3e20 242 }
nherriot 15:262da03e3e20 243
nherriot 15:262da03e3e20 244
nherriot 15:262da03e3e20 245
nherriot 15:262da03e3e20 246 if ((strcmp (msg, "open") ==0)|| (strcmp(num,"TrackaPhone")==0))
nherriot 8:1b4e84f4c451 247 {
nherriot 2:bcc9256ecaab 248 DBG("The SMS message indicates I should open the door");
nherriot 7:316c2dac06a5 249
nherriot 7:316c2dac06a5 250 // check the door is not already open if it is do nothing and send a warning back to the sender
nherriot 7:316c2dac06a5 251 // for this door the switch 'true' then its closed - we have to have an active signal to show it's securely closed
nherriot 8:1b4e84f4c451 252
nherriot 15:262da03e3e20 253 if (read_digital() == 0 )
nherriot 7:316c2dac06a5 254 {
nherriot 7:316c2dac06a5 255 DBG("The door is already open - so I'll do nothing");
nherriot 8:1b4e84f4c451 256 connectionManager.sendSM(num, " WARNING - The door is already open sir! ");
nherriot 7:316c2dac06a5 257 }
nherriot 7:316c2dac06a5 258 else
nherriot 7:316c2dac06a5 259 {
nherriot 7:316c2dac06a5 260 doorContactorRelay = 1;
nherriot 8:1b4e84f4c451 261 openTheDoor = true; // set the state vairable to let the door contoller know it needs to open the door
nherriot 22:87d73be30243 262 alarmActive = false; // set the alarm OFF until the door is open
nherriot 22:87d73be30243 263 led4 = 0; // set the alarm light to off
nherriot 22:87d73be30243 264 DBG("The ALARM is now set to %d: ", alarmActive);
nherriot 7:316c2dac06a5 265 led3 = 1;
nherriot 7:316c2dac06a5 266 DBG("The relay has been activated to open the door");
nherriot 8:1b4e84f4c451 267 connectionManager.sendSM(num, " Door open sir... Welcome home! " );
nherriot 8:1b4e84f4c451 268 }
nherriot 8:1b4e84f4c451 269 }
nherriot 8:1b4e84f4c451 270 else
nherriot 8:1b4e84f4c451 271 {
nherriot 2:bcc9256ecaab 272 DBG("The SMS message is not recognized");
nherriot 7:316c2dac06a5 273 connectionManager.sendSM(num, " Wrong password sir... Try 'open' and I'll open! ;-) ");
nherriot 2:bcc9256ecaab 274 }
nherriot 2:bcc9256ecaab 275
nherriot 2:bcc9256ecaab 276
nherriot 2:bcc9256ecaab 277
nherriot 0:5136cdfaebd0 278 }
nherriot 6:5a892c3d738e 279 Thread::wait(500);
nherriot 0:5136cdfaebd0 280 }
nherriot 0:5136cdfaebd0 281
nherriot 0:5136cdfaebd0 282 }
nherriot 0:5136cdfaebd0 283
nherriot 0:5136cdfaebd0 284 void keepAlive(void const*) {
nherriot 0:5136cdfaebd0 285 while(1)
nherriot 0:5136cdfaebd0 286 {
nherriot 8:1b4e84f4c451 287 led2=!led2;
nherriot 0:5136cdfaebd0 288 Thread::wait(500);
nherriot 0:5136cdfaebd0 289 }
nherriot 0:5136cdfaebd0 290 }
nherriot 0:5136cdfaebd0 291
nherriot 0:5136cdfaebd0 292 void tick()
nherriot 0:5136cdfaebd0 293 {
nherriot 0:5136cdfaebd0 294 led4=!led4;
nherriot 0:5136cdfaebd0 295 }
nherriot 0:5136cdfaebd0 296
nherriot 0:5136cdfaebd0 297 int main() {
nherriot 16:9245c3a37491 298 //Ticker t;
nherriot 16:9245c3a37491 299 //t.attach(tick,1);
nherriot 0:5136cdfaebd0 300 DBG_INIT();
nherriot 12:e622e146b3cd 301 DBG_SET_SPEED(115200);
nherriot 23:28b693d586ee 302 test(NULL);
nherriot 23:28b693d586ee 303 //Thread testTask(test, NULL, osPriorityNormal, 1024*5);
nherriot 0:5136cdfaebd0 304
donatien 14:9ee94196b75d 305 keepAlive(NULL);
nherriot 0:5136cdfaebd0 306
nherriot 0:5136cdfaebd0 307
nherriot 0:5136cdfaebd0 308 return 0;
nherriot 0:5136cdfaebd0 309 }