Hi,
Finally, my problem is solved !
I was extracting main lines codes from my application to post here, and had some ideas....
In fact, since Characterostics are only "unsigned char *" type when using for a string, it's obliged to cast variables used to write from or to.
Here is my simplified example.
//-------------------------------------------- Includes for BLE
#include <BLEAttribute.h>
#include <BLECentral.h>
#include <BLECharacteristic.h>
#include <BLECommon.h>
//#include <BLEDescriptor.h>
#include <BLEPeripheral.h>
#include <BLEService.h>
#include <BLETypedCharacteristic.h>
#include <BLETypedCharacteristics.h>
#include <BLEUuid.h>
#include <CurieBLE.h>
//----------------------------------------------------------- BLE declaring
BLEPeripheral blePeripheral;
BLEService InitAdmin("41300000-EB90-09D7-0001-413031360000");
BLECharacteristic Ssid("41300001-EB90-09D7-0001-413031360000", BLERead | BLEWrite,16);
//---------------------------------------------------------------------- Global Variables
int i;
char SsidLocal[32] ;
//----------------------------------------------------------------- Initialisation
void setup()
{
Serial.begin(9600);
// Set advertised local name and service UUID:
blePeripheral.setLocalName("ASE_A016");
blePeripheral.setDeviceName("ASE_A016");
blePeripheral.setAppearance(true);
// No visible service ?
//blePeripheral.setAdvertisedServiceUuid(InitAdmin.uuid());
// Add Service & Caracteristic
blePeripheral.addAttribute(InitAdmin);
blePeripheral.addAttribute(Ssid);
// Write into the SSID characteristic
sprintf(SsidLocal,"AZERTYUIOPQSDFGH");
Ssid.setValue((unsigned char *)SsidLocal,16) ; // Needs to cast because setValue accepts only unsigned char *
// begin advertising BLE service:
blePeripheral.begin();
Serial.println("A016 peripheral running...");
Serial.println("");
}
//----------------------------------------------------------------------- Main loop
void loop()
{
// listen for BLE peripherals to connect:
BLECentral central = blePeripheral.central();
// if a central is connected to peripheral:
if (central)
{
// print the central's MAC address:
Serial.print("Connected to central: ");
Serial.println(central.address());
// while the central is still connected to peripheral:
while (central.connected())
{
if (Ssid.written()) // le SSID
{
Serial.print("Admin : SSID recu ");
sprintf(SsidLocal,(char *)Ssid.value()); // Needs to cast because Value is unsigned char *
Serial.println(SsidLocal);
}
delay(250);
}
// when the central disconnects, print it out:
Serial.print("Disconnected from central: ");
Serial.println(central.address());
Serial.println();
}
}
If this may help someone !
Regards.