Looks pretty good. However... This would look even better if we added in unit tests to catch the double and bool failure cases. :-)
A quick addition of at least one test per case in that switch should help keep the code easier to maintain. On 08/11/2015 11:44 AM, Keane, Erich wrote: > Since I was able to reproduce it, I pushed a work-around patch here: > https://gerrit.iotivity.org/gerrit/#/c/2171/ > > It seems to be an issue with 4.6, as 4.7 and greater doesn't have this > issue. The conversion operator overload was not working the way it > should (and it does in 4.9), so this forces it to happen via a function > call. > > Can you retest here? > Thanks, > Erich > > On Tue, 2015-08-11 at 07:58 +0000, soyoung youn wrote: >> I have tried it once again, but still have a same issue. >> >> Below is my run of simpleclient on 0.9.2-RC3. >> >> You can see that there is no change in state variable. >> (false->false->false->....) >> >> >> >> To fix this issue, I have tried to build code with various version of >> gcc(version 4.6, 4.7, 4.9), because I thouht it may have a dependency >> on gcc version. >> >> However, it has no effect and still not working. >> >> >> >> Is there anyone who knows the reason why this kind of issue happened? >> >> >> >> >> >> - Soyoung >> >> >> >> >> >> GET request was successful >> Resource URI: /a/light >> state: false >> power: 0 >> name: John's light >> Putting light representation... >> PUT request was successful >> state: false >> power: 15 >> name: John's light >> Posting light representation... >> POST request was successful >> Uri of the created resource: /a/light1 >> Posting light representation... >> POST request was successful >> state: false >> power: 55 >> name: John's light >> >> Observe is used. >> >> OBSERVE RESULT: >> SequenceNumber: 0 >> state: false >> power: 55 >> name: John's light >> OBSERVE RESULT: >> SequenceNumber: 5 >> state: false >> power: 65 >> name: John's light >> OBSERVE RESULT: >> SequenceNumber: 6 >> state: false >> power: 75 >> name: John's light >> >> >> ------- Original Message ------- >> >> Sender : Keane, Erich<erich.keane at intel.com> >> >> Date : 2015-08-11 02:23 (GMT+09:00) >> >> Title : Re: [dev] bool type issue (in RC3 branch) >> >> >> >> I have tried to reproduce this, and cannot. Below is my run of >> simplecient on 0.9.2-RC3. You can see that state goes from false to >> true, and that the variables are being changed on both sides. >> >> -Erich >> >> [ekeane1 at ekeane1-desk1 examples]$ ./simpleclient >> >> --------------------------------------------------------------------- >> Usage : simpleclient >> ObserveType : 1 - Observe >> ObserveType : 2 - ObserveAll >> --------------------------------------------------------------------- >> >> <===Setting ObserveType to Observe and ConnectivityType to IP===> >> >> Finding Resource... >> Finding Resource for second time... >> In foundResource >> Found resource 7ed4e220-1461-4585-9ee6-f18c65893d05/a/light for the >> first time on server with ID: 7ed4e220-1461-4585-9ee6-f18c65893d05 >> DISCOVERED Resource: >> URI of the resource: /a/light >> Host address of the resource: coap://134.134.161.69:59605 >> List of resource types: >> core.light >> core.brightlight >> List of resource interfaces: >> oic.if.baseline >> oic.if.ll >> Getting Light Representation... >> 0: listenCallback(): failed to create resource. clientResponse: 33 >> In foundResource >> Found resource 7ed4e220-1461-4585-9ee6-f18c65893d05/a/light again! >> Found another resource, ignoring >> 0: listenCallback(): failed to create resource. clientResponse: 33 >> GET request was successful >> Resource URI: /a/light >> state: false >> power: 0 >> name: John's light >> Putting light representation... >> PUT request was successful >> state: true >> power: 15 >> name: John's light >> Posting light representation... >> POST request was successful >> Uri of the created resource: /a/light1 >> Posting light representation... >> POST request was successful >> state: true >> power: 55 >> name: John's light >> >> >> >> On Mon, 2015-08-10 at 09:38 +0000, ??? wrote: >>> Hi All, >>> >>> >>> >>> Recently I found some issues in RC3 branch, when there is a request >> of >>> bool type's data between OIC Server and Client. >>> >>> >>> >>> For examle, I could not see any log changed in state value(which >> type >>> is bool), even though there is a code about changing state value. >>> >>> (like m_state = false to m_state = true) >>> >>> The problem is occurred not only this simpleserver/simpleclient >>> app, but also other sample app, such as roomserver/roomclient. >>> >>> >>> >>> To sum up the issue, Integer type's value is working well (I mean >> the >>> Integer value is changed well), but bool type's value isn't. >>> >>> Also, I am not sure that other types of value (except integer >>> type) would be working well or not. >>> >>> >>> >>> >>> >>> Thanks. >>> >>> >>> >>> Best Regards, >>> >>> Soyoung Youn. >>> >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> iotivity-dev mailing list >>> iotivity-dev at lists.iotivity.org >>> https://lists.iotivity.org/mailman/listinfo/iotivity-dev >> >> >> >> >> >> ?????. >> >> >> >> ??? ?? >> >> >> >> >> >> >> > > _______________________________________________ > iotivity-dev mailing list > iotivity-dev at lists.iotivity.org > https://lists.iotivity.org/mailman/listinfo/iotivity-dev > -- Jon A. Cruz - Senior Open Source Developer Samsung Open Source Group jonc at osg.samsung.com
