GSoC 2019 Coding Period Week 7

Submitted by steven on Sun, 07/14/2019 - 09:50

As I mentioned in another blog, I can edit the value of Thing property when creating the Thing entity by Inline Entity Form (IEF).  After adding an Entity Reference type of field, commonly used WIDGET is Autocomplete/Autocomplete (tags style) instead of IEF. In the case of points, IEF is used by default after adding a field of entity reference type where the target type is points. So I need to refer to points to implement hook_entity_presave().  

Fill in the label of the reference entity using Autocomplete (tags style):

tags

Edit a complete entity using Inline Entity Form:

points

Make sure that this button is checked when you add a Thing property field to the bundle of Thing type because Thing property did not exist before Thing was created:

reference_type

Setting default value cannot render when the WIDGET is set to Inline Entity Form.

Currently, in order to change the default value, I have to switch the widget to use a non-IEF widget, and then switch the widget back after saving. (see issue: Widget doesn't render for setting default value)

tagss

I created a bunch of predefined Thing property bundles. Maybe I need to create the predefined Thing type bundle according to Capabilities. If I do this, it will make the consumer's ability to use this module much more useful. However, this approach will create a bundle of Thing type with a single capability. Another question, I don't think there's a good way for consumers not to edit certain values of entity reference fields. How to make 'read-only' uneditable while Motion value can still be editable in the value of MotionSensor?I found one comment in favor of not pre-defining Thing types:

We're also finding that defining web thing types at just the thing level is too inflexible. Through the W3C we are investigating standardising "capabilities" - types of properties, actions and events which can be mixed and matched between devices. (See issue on GitHub Get rid of the concrete Web Thing Types #56)  

I searched for the WOT specification project on GitHub for read-only discussions. And another project on Read-only properties #1261. This discussion depends on mozilla-iot/wot#38. Because predefined Thing types are not supported, the read-only attribute is not set to immutable on a certain Thing type. But it is still important to know how to use the read-only property. I found a good point about read-only properties.

https://github.com/mozilla-iot/wot/issues/38#issuecomment-313448788

I think that there are 2 very distinct concepts here.
1 - Whether a property is physically writable/modifiable or not.
2 - Whether a user is authorized to modify a modifiable property