浏览代码

Added SMS send code to core::notifyFailures

tags/v1.2.0
Bertrand Lemasle 6 年前
父节点
当前提交
250b5b3371
共有 3 个文件被更改,包括 10 次插入2 次删除
  1. +6
    -1
      GpsTracker/Core.cpp
  2. +0
    -1
      GpsTracker/Network.cpp
  3. +4
    -0
      GpsTracker/Network.h

+ 6
- 1
GpsTracker/Core.cpp 查看文件

@@ -57,7 +57,12 @@ namespace core {
sprintf_P(buffer + strlen(buffer), PSTR(" - Temperature is %.2f°C. Backup battery failure ?\n"), metadata.batteryLevel);
}

//TODO : send sms, return if failed
config_t* config = &config::main::value;
if (!network::sendSms(config->contactPhone, buffer)) {
NOTICE_MSG("notifyFailure", "SMS not sent !");
return;
}

alerts::add(notified); //only add the successly notified failures
//TODO : network::powerOff(); count "handles" like for i2c ?
}


+ 0
- 1
GpsTracker/Network.cpp 查看文件

@@ -63,5 +63,4 @@ namespace network {
bool enableGprs() {
return hardware::sim808::device.enableGprs(config::main::value.network.apn);
}
}

+ 4
- 0
GpsTracker/Network.h 查看文件

@@ -10,4 +10,8 @@ namespace network {
SIM808RegistrationStatus waitForRegistered(uint32_t timeout, bool relativeToPowerOnTime = true);
bool isAvailable(SIM808_NETWORK_REGISTRATION_STATE state);
bool enableGprs();

inline bool sendSms(const char * phoneNumber, const char * msg) {
return hardware::sim808::device.sendSms(phoneNumber, msg);
}
}

正在加载...
取消
保存