Dear all,

Is there any "Arduino BLE" manager in Iotivity-dev who knows?
I need his help.

Best regards,
Roy Kang.

2015-12-28 16:38 GMT+09:00 Roy Kang <roykang75 at gmail.com>:

>
> Dear All,
>
> I was debugging issue that device is disconnected.
>
> I guess that root cause is below log. (Refer to *RED* color)
>
> ==================================================
> INFO: ocresource: Extracting params from rt=core.light
> INFO: ocresource: Extracted params
> *FATAL: OCStack: Generate UUID for Server Instance failed!*
> INFO: ocresource: /oic/ad not ACTIVE or DISCOVERABLE
> INFO: ocresource: /oic/d does not contain rt=core.light.
> ==================================================
>
> Error code is as below.
> <Iotivity>/resource/csdk/stack/src/ocstack.c
> <Iotivity>/resource/csdk/security/src/doxmeresource.c const OicUuid_t*
> OCGetServerInstanceID(void)
> {
>     static bool generated = false;
>     static OicUuid_t sid;
>     if (generated)
>     {
>         return &sid;
>     }
>
>     if (*GetDoxmDeviceID*(&sid) != OC_STACK_OK)
>     {
>         OC_LOG(FATAL, TAG, "Generate UUID for Server Instance failed!");
>         return NULL;
>     }
>     generated = true;
>     return &sid;
> } ==> /**
>  * This method returns the SRM device ID for this device.
>  *
>  * @retval  OC_STACK_OK for Success, otherwise some error value
>  */
> OCStackResult *GetDoxmDeviceID*(OicUuid_t *deviceID)
> {
>     if(deviceID && *gDoxm*)
>     {
>        *deviceID = gDoxm->deviceID;
>         return OC_STACK_OK;
>     }
>     return OC_STACK_ERROR;
> }
> gDoxm is NULL.
> So, errro occurs.
>
> gDoxm creation flow is as below.
>
> <Iotivity>/resource/csdk/stack/src/ocstack.c
> <Iotivity>/resource/csdk/stack/src/ocstack.c
> <Iotivity>/resource/csdk/security/src/securesourcemanager.c
> <Iotivity>/resource/csdk/security/src/securesourcemanager.c OCStackResult
> *OCInit1*(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags
> clientFlags)
> {
>     ?????
>     //Update Stack state to initialized
>     stackState = OC_STACK_INITIALIZED;
>
>     // Initialize resource
>     if(myStackMode != OC_CLIENT)
>     {
>         result = initResources();
>     }
>     ?????
> } ==> OCStackResult *initResources*()
> {
>     ?????
> #ifndef WITH_ARDUINO
>     if (result == OC_STACK_OK)
>     {
>         result = SRMInitSecureResources();
>     }
> #endif
>     ?????
> } ==> OCStackResult *SRMInitSecureResources*()
> {
>     // TODO: temporarily returning OC_STACK_OK every time until default
>     // behavior (for when SVR DB is missing) is settled.
>     InitSecureResources();
>
> #if defined(__WITH_DTLS__)
>     CARegisterDTLSCredentialsHandler(GetDtlsPskCredentials);
> #endif // (__WITH_DTLS__)
> #if defined(__WITH_X509__)
>     CARegisterDTLSX509CredentialsHandler(GetDtlsX509Credentials);
>     CARegisterDTLSCrlHandler(GetDerCrl);
> #endif // (__WITH_X509__)
>
>     return OC_STACK_OK;
> } ==> /**
>  * Initialize all secure resources ( /oic/sec/cred, /oic/sec/acl,
> /oic/sec/pstat etc).
>  *
>  * @retval  OC_STACK_OK for Success, otherwise some error value
>  */
> OCStackResult *InitSecureResources*( )
> {
>     OCStackResult ret;
>     /*
>      * doxm resource should be initialized first as it contains the
> DeviceID
>      * which MAY be used during initialization of other resources.
>      */
>     ret = InitDoxmResource();
> Because condition of "#ifndef WITH_ARDUINO" code. gDoxm doesn't created.
> (Refer to GREEN color on "Step 2" )
>
> WITH ARDUINO has been defined in
> "<Iotivity>/resource/csdk/arduinomega.properties".
>
> So, ((OCDiscoveryPayload*)payload)->sid is NULL.
>
> <Iotivity>/resource/csdk/stack/src/ocresource.c static OCStackResult
> HandleVirtualResource (OCServerRequest *request, OCResource* resource)
> {
>     ?????
>         if (discoveryResult == OC_STACK_OK)
>         {
>             payload = (OCPayload*)OCDiscoveryPayloadCreate();
>
>             if(payload)
>             {
>                 ((OCDiscoveryPayload*)payload)->sid =
> (uint8_t*)OICCalloc(1, UUID_SIZE);
>                 memcpy(((OCDiscoveryPayload*)payload)->sid,
> OCGetServerInstanceID(), UUID_SIZE);
>
>                 bool foundResourceAtRD = false;
>     ?????
> }
> I guess that sid is very important.
> Client sent discovery message and then receive response.
> But client cannot finish about this flow because sid is NULL (or garbage)
> on response message.
>
> I'm not sure my opinion is correct.
> I will plan continue debugging.
>
> Please let me know if you have any other comments.
>
> Best regards,
> ST Kang
>
> 2015-12-28 0:46 GMT+09:00 Roy Kang <roykang75 at gmail.com>:
>
>> Dear All,
>>
>> I am very interested Iotivity Project.
>> So, i try test between Arduino mega and Anrdroid via BLE using master
>> branch(20151227)
>> (example: SimpleClientServer)
>>
>> Arduino environment: Arduino Mega 2560 + RedBearLab BLE Shield v2.1.
>> Android environment: Andorid 5.0.2 (LG G PAD)
>>
>> Step 1) Run arduino.
>> Step 2) Run SimpleClient app on Android and then click "START".
>>
>> When viewing the log, device found.
>> After server sent response to client, devices is disconnected.
>>
>> ==================================================================
>> data transmmit success!  Length: 20    Data Credit available: 1
>> Pipe Number: 3
>> Pipe Number: 3
>> Pipe Number: 3
>> Evt Disconnected/Advertising timed out
>> Advertising started
>> data transmmit success!  Length: 2    Data Credit available: 1
>> ACI Evt Pipe Error: Pipe #:4  Pipe Error Code: 0x83
>> Data Credit available: 2
>> ==================================================================
>>
>> I don't know why occurs this problem.
>> Could anybody help me ?
>>
>> Full log is attached.
>>
>> Best regards.
>> ST Kang.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160107/d19e6f47/attachment.html>

Reply via email to