forked from Integreight/1Sheeld-Arduino-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFacebookShield.cpp
66 lines (49 loc) · 1.53 KB
/
FacebookShield.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
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
Project: 1Sheeld Library
File: FacebookShield.cpp
Version: 1.0
Compiler: Arduino avr-gcc 4.3.2
Author: Integreight
Date: 2014.5
*/
#define FROM_ONESHEELD_LIBRARY
#include "OneSheeld.h"
#include "FacebookShield.h"
//Post Sender
void FacebookShieldClass::post(const char* status)
{
//Check length of string
int statusLength = strlen(status);
if(!statusLength) return;
OneSheeld.sendShieldFrame(FACEBOOK_ID,0,FACEBOOK_UPDATE_STATUS,1,new FunctionArg(statusLength,(byte*)status));
}
void FacebookShieldClass::post(String status)
{
int statusLength = status.length();
char cTypeStatus [statusLength+1];
for(int i=0; i<statusLength; i++)
{
cTypeStatus[i]=status[i];
}
cTypeStatus[statusLength]='\0';
post(cTypeStatus);
}
void FacebookShieldClass::postLastPicture(const char * pictureText, byte imageSource)
{
//Check length of string
int pictureTextLength = strlen(pictureText);
if(!pictureTextLength) return;
OneSheeld.sendShieldFrame(FACEBOOK_ID,0,FACEBOOK_POST_LAST_PIC,2,new FunctionArg(pictureTextLength,(byte*)pictureText),
new FunctionArg(1,(byte *)&imageSource));
}
void FacebookShieldClass::postLastPicture(String pictureText , byte imageSource)
{
int pictureTextLength = pictureText.length();
char cTypePictureText [pictureTextLength+1];
for(int i=0 ;i<pictureTextLength;i++)
{
cTypePictureText[i] = pictureText[i];
}
cTypePictureText[pictureTextLength]='\0';
postLastPicture(cTypePictureText,imageSource);
}