forked from Integreight/1Sheeld-Arduino-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FoursquareShield.cpp
53 lines (39 loc) · 1.21 KB
/
FoursquareShield.cpp
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
42
43
44
45
46
47
48
49
50
51
52
/*
Project: 1Sheeld Library
File: FoursquareShield.cpp
Version: 1.0
Compiler: Arduino avr-gcc 4.3.2
Author: Integreight
Date: 2014.5
*/
#define FROM_ONESHEELD_LIBRARY
#include "OneSheeld.h"
#include "FoursquareShield.h"
//Checking-In Sender
void FoursquareShieldClass::checkIn(const char* placeId,const char* message)
{
//Check length of string
int placeIdLength = strlen(placeId);
int messageLength = strlen(message);
if(!placeIdLength || !messageLength) return;
OneSheeld.sendShieldFrame(FOURSQUARE_ID,0,FOURSQUARE_CHECK_IN,2,new FunctionArg(placeIdLength,(byte*)placeId),
new FunctionArg(messageLength,(byte*)message));
}
void FoursquareShieldClass::checkIn(String placeId , String message)
{
int placeIdLength = placeId.length();
int messageLegnth = message.length();
char cTypePlaceId [placeIdLength+1];
char cTypeMessage [messageLegnth+1];
for (int i=0 ;i <placeIdLength ;i++)
{
cTypePlaceId[i] = placeId [i];
}
cTypePlaceId[placeIdLength]='\0';
for(int j=0 ;j<messageLegnth ;j++)
{
cTypeMessage[j] = message[j];
}
cTypeMessage[messageLegnth]='\0';
checkIn(cTypePlaceId,cTypeMessage);
}