Hello again,
I'm please to close this topic with some explaination about this problem and ho I solved it.
In fact, since string manipulating functions and characteristic methods doesn't use the same variables types, I simply added some casting fnuctions to convert each variable types from char to/from unsigned char.
As an 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) ;
// 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 ");
Serial.println(Ssid.valueLength());
sprintf(SsidLocal,"%16c",NULL);
strncpy(SsidLocal,(char*)Ssid.value(),Ssid.valueLength());
Serial.println(SsidLocal);
}
delay(250);
}
// when the central disconnects, print it out:
Serial.print("Disconnected from central: ");
Serial.println(central.address());
Serial.println();
}
}
Have a nice day !
PAtrick