Pushafer Arduino error

Pushsafer make it easy and safe to get push-notifications in real time on your Android or Windows mobile device, iPhone, iPad and Desktop!

Mit Pushsafer kann man in Echtzeit, einfach und sicher, Push-Benachrichtigungen auf sein iPhone, iPad, Android oder Windows Gerät sowie auf den Desktop senden lassen!

======================
Google Play
App Store
Windows 10 Store
Homepage
valonso
Posts: 5
Joined: 16. Apr 2018, 16:04

Pushafer Arduino error

Postby valonso » 16. Apr 2018, 16:12

Dear sirs:

After compile the example I obtain this errors attached lower and the compilation stops.
Please could you tell me where is the error in the copy/paste of the example in this URL

https://www.pushsafer.com/en/arduino

Best regards

-----------------------------
Arduino:1.8.5 (Windows 7), Tarjeta:"Arduino/Genuino Uno"

G:\42-programacion\PUSHsafer-master\Pushsafer\Pushsafer.ino: In function 'byte pushsafer(char*, char*, int, int, int, char*, char, char, int)':

Pushsafer:42: error: request for member 'length' in 'sound', which is of non-class type 'int'

length = 30 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + url.length() + urltitle.length() + time2live.length() + privatekey.length();

^

Pushsafer:42: error: request for member 'length' in 'vibration', which is of non-class type 'int'

length = 30 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + url.length() + urltitle.length() + time2live.length() + privatekey.length();

^

Pushsafer:42: error: request for member 'length' in 'icon', which is of non-class type 'int'

length = 30 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + url.length() + urltitle.length() + time2live.length() + privatekey.length();

^

Pushsafer:42: error: request for member 'length' in 'url', which is of non-class type 'char'

length = 30 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + url.length() + urltitle.length() + time2live.length() + privatekey.length();

^

Pushsafer:42: error: request for member 'length' in 'urltitle', which is of non-class type 'char'

length = 30 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + url.length() + urltitle.length() + time2live.length() + privatekey.length();

^

Pushsafer:42: error: request for member 'length' in 'time2live', which is of non-class type 'int'

length = 30 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + url.length() + urltitle.length() + time2live.length() + privatekey.length();

^

Pushsafer:42: error: request for member 'length' in 'privatekey', which is of non-class type 'char [21]'

length = 30 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + url.length() + urltitle.length() + time2live.length() + privatekey.length();

^

exit status 1
request for member 'length' in 'sound', which is of non-class type 'int'

Este reporte podría tener más información con
"Mostrar salida detallada durante la compilación"
opción habilitada en Archivo -> Preferencias.

Online
User avatar
admin
Site Admin
Posts: 336
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: Pushafer Arduino error

Postby admin » 16. Apr 2018, 19:12

please replace this

Code: Select all

  pushsafer("It works!!!","Test",1,1,1,"a");  
by this

Code: Select all

  pushsafer("It works!!!","Test","1","1","1","a");  
and try again
DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

valonso
Posts: 5
Joined: 16. Apr 2018, 16:04

Re: Pushafer Arduino error

Postby valonso » 17. Apr 2018, 08:28

Dear sir

I had check both sintaxis modes and the compilation error persits.
Here you have a screenshot of the Arduino IDE.

I do not inderstand why the syntaxis error appear
"request for member 'length' in 'sound', which is of non-class type 'int'

Please any clue ?
Regards
Attachments
error-INT.jpg
screenshot of the syntaxis error in IDE
error-INT.jpg (99.5 KiB) Viewed 3208 times

Online
User avatar
admin
Site Admin
Posts: 336
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: Pushafer Arduino error

Postby admin » 17. Apr 2018, 14:50

please change this line

Code: Select all

byte pushsafer(char *pushsafermessage, char *pushsafertitle, int sound, int vibration, int icon, char *psdevice)
to this

Code: Select all

byte pushsafer(char *pushsafermessage, char *pushsafertitle, char sound, char vibration, char icon, char *psdevice)
Kevin
DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

valonso
Posts: 5
Joined: 16. Apr 2018, 16:04

Re: Pushafer Arduino error

Postby valonso » 20. Apr 2018, 16:34

Code: Select all

// byte pushsafer(char *pushsafermessage, char *pushsafertitle, int sound, int vibration, int icon, char *psdevice)
byte pushsafer(char *pushsafermessage, char *pushsafertitle, char sound, char vibration, char icon, char *psdevice)
{
  String title = pushsafertitle;
  String message = pushsafermessage;
  String device = psdevice;

int length = 41 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + privatekey.length();

Dear sir , I am terribly sorry but I do not know what is wrong, the error remains.

-----------------------------
G:\42-programacion\PUSHsafer-Arduino\Pushsafer-Arduino.ino: In function 'byte pushsafer(char*, char*, char, char, char, char*)':

Pushsafer-Arduino:44: error: request for member 'length' in 'sound', which is of non-class type 'char'

int length = 41 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + privatekey.length();

^

Pushsafer-Arduino:44: error: request for member 'length' in 'vibration', which is of non-class type 'char'

int length = 41 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + privatekey.length();

^

Pushsafer-Arduino:44: error: request for member 'length' in 'icon', which is of non-class type 'char'

int length = 41 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + privatekey.length();

^

Pushsafer-Arduino:44: error: request for member 'length' in 'privatekey', which is of non-class type 'char [21]'

int length = 41 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + privatekey.length();

----------------------------------------- ^

exit status 1
request for member 'length' in 'sound', which is of non-class type 'char'

Online
User avatar
admin
Site Admin
Posts: 336
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: Pushafer Arduino error

Postby admin » 20. Apr 2018, 21:33

Please use this

Code: Select all

/*
   Pushsafer.ino
   Pushsafer.com sketch by Appzer.de Kevin Siml 2016-08-08
   Send pushsafer.com messages from the arduino
*/

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {0xDE,0xAC,0xBF,0xEF,0xFE,0xAA};

// pushsafer settings
char privatekey[] = "your20characterPrivateKey";

int length;

EthernetClient client;

void setup()
{
  Serial.begin(9600);
  Serial.print(F("Starting ethernet..."));
  if(!Ethernet.begin(mac)) Serial.println("failed");
  else Serial.println(Ethernet.localIP());

  delay(5000);
  Serial.println("Ready");
}

void loop()
{
  pushsafer("It works!!!","Test","1","1","1","a");  
  delay(60000); 
}

byte pushsafer(char *pushsafermessage, char *pushsafertitle, char *pssound, char *psvibration, char *psicon, char *psdevice)
{
  String title = pushsafertitle;
  String message = pushsafermessage;
  String device = psdevice;
  String sound = pssound;
  String vibration = psvibration;
  String icon = psicon;

  length = 41 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + privatekey.length();

  if(client.connect("pushsafer.com",80))
  {
    client.println("POST /api HTTP/1.1");
    client.println("Host: https://www.pushsafer.com");
    client.println("Connection: close\r\nContent-Type: application/x-www-form-urlencoded");
    client.print("Content-Length: ");
    client.print(length);
    client.println("\r\n");;
    client.print("k=");
    client.print(privatekey);
    client.print("&m=");
    client.print(message);
    client.print("&t=");
    client.print(title);	
    client.print("&s=");
    client.print(sound);
    client.print("&v=");
    client.print(vibration);	
    client.print("&i=");
    client.print(icon);
    client.print("&d=");
    client.print(device);	
    client.print("&retry=60");
    client.print("&expire=3600");
    while(client.connected())  
    {
      while(client.available())
      {
        char ch = client.read();
        Serial.write(ch);
      }
    }
    client.stop();
  }  
}
DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

valonso
Posts: 5
Joined: 16. Apr 2018, 16:04

Re: Pushafer Arduino error

Postby valonso » 25. Apr 2018, 17:58

Sorry but also and strange error for me.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Arduino:1.8.5 (Windows 7), Tarjeta:"Arduino/Genuino Uno"

G:\42-programacion\PUSHSAFER-Foro\PUSHSAFER-Foro.ino: In function 'byte pushsafer(char*, char*, char*, char*, char*, char*)':

PUSHSAFER-Foro:45: error: request for member 'length' in 'privatekey', which is of non-class type 'char [21]'

length = 41 + message.length() + title.length() + sound.length() + vibration.length() + icon.length() + device.length() + privatekey.length();

^

exit status 1
request for member 'length' in 'privatekey', which is of non-class type 'char [21]'

Este reporte podría tener más información con
"Mostrar salida detallada durante la compilación"
opción habilitada en Archivo -> Preferencias.

Online
User avatar
admin
Site Admin
Posts: 336
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: Pushafer Arduino error

Postby admin » 25. Apr 2018, 18:50

Hi,

sorry, but i can not test the script. So we have to test!

Please change this line

Code: Select all

char privatekey[] = "your20characterPrivateKey";
to this

Code: Select all

String privatekey[] = "your20characterPrivateKey";
or this

Code: Select all

String privatekey = "your20characterPrivateKey";
DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

valonso
Posts: 5
Joined: 16. Apr 2018, 16:04

Re: Pushafer Arduino error

Postby valonso » 26. Apr 2018, 13:03

Dear Sir.

It is a pleasure to report that the right sintaxis is;

String privatekey = "miclaveprivada";

Thanks a lot for your support.
Please consider to update the script in te wer rsources and tell to others users with the same sintaxis problem.

With more time I will try the full experiment to learn how to send push notifi¡cations to my mobile

Best regards

Online
User avatar
admin
Site Admin
Posts: 336
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: Pushafer Arduino error

Postby admin » 26. Apr 2018, 16:32

great to hear :-)
DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10


Who is online

Users browsing this forum: admin, Bing [Bot], Majestic-12 [Bot] and 1 guest