forked from Integreight/1Sheeld-Arduino-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotificationShield.cpp
More file actions
42 lines (30 loc) · 852 Bytes
/
NotificationShield.cpp
File metadata and controls
42 lines (30 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
Project: 1Sheeld Library
File: NotificationShield.cpp
Version: 1.0
Compiler: Arduino avr-gcc 4.3.2
Author: Integreight
Date: 2014.5
*/
#define FROM_ONESHEELD_LIBRARY
#include "OneSheeld.h"
#include "NotificationShield.h"
//Notification Sender
void NotificationShieldClass::notifyPhone(const char* data)
{
//Check length of string
int dataLength = strlen(data);
if(!dataLength) return;
OneSheeld.sendShieldFrame(NOTIFICATION_ID,0,NOTIFICATION_NOTIFY_PHONE,1,new FunctionArg(dataLength,(byte*)data));
}
void NotificationShieldClass::notifyPhone(String data)
{
int dataLength = data.length();
char cTypeData [dataLength+1];
for(int i=0 ;i<dataLength;i++)
{
cTypeData[i] = data[i];
}
cTypeData[dataLength]='\0';
notifyPhone(cTypeData);
}