[sedonadev] how to correctly setup a string property slot

88 views
Skip to first unread message

keith bradley

unread,
May 16, 2017, 7:41:53 PM5/16/17
to sedo...@googlegroups.com
So I have:

  @config
  @asStr
  property
  Buf(18) MAC_Addr

... in my kit's comp.

When I type something in it ... code sees it ... but the editor (SAE) shows blank no mater how many times I type in there.

Do you have to do changed(kit.comp) sorta thing?

Where would you do this?

I did it in the changed callback and the VM crashed.

Any ideas?


Mateusz Klatecki

unread,
May 17, 2017, 8:32:46 AM5/17/17
to Sedona Framework
Hi,

If you change Buf slot you have to invoke changed method as described in documentation: http://www.sedonadev.org/doc/components.html#bufProperties

In your case :

changed(YourComponentName.MAC_Addr)


best regards
Mateusz Klatecki

Mateusz Klatecki

unread,
May 17, 2017, 8:32:46 AM5/17/17
to sedo...@googlegroups.com
Hi,

If you change Buf slot you have to manualy invoke changed method as described in doc: http://www.sedonadev.org/doc/components.html#bufProperties

in your case:
changed(YourComponentName.MAC_Addr);

best regards
Mateusz Klatecki

--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.
To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.

keith bradley

unread,
May 17, 2017, 10:15:57 AM5/17/17
to sedo...@googlegroups.com
When the user edits this slot inside the editor ... how, where would you do this?

I tried this inside the changed callback and the VM crashed.

Mateusz Klatecki

unread,
May 17, 2017, 12:54:34 PM5/17/17
to sedo...@googlegroups.com
If the user change slot in Sedona Editor you do not need do anything. Changed method will be invoked automatically. You can write code to do something in this method ex:

Override void changed(Slot slot){
if (slot == YourComponent.MAC_Addr){
//Do something
}
}

Or in execute method as well

keith bradley

unread,
May 17, 2017, 8:51:46 PM5/17/17
to sedo...@googlegroups.com


well I am doing this but the text I type is not there ... always blank.


I wonder if it is a bug in the Ccontrols SAE.

When I save the app and convert to sax it crashed with an error "not string".

When I look at the sab it has part of my string but gobble dee gook in front.

keith bradley

unread,
May 20, 2017, 2:58:16 PM5/20/17
to sedo...@googlegroups.com
I am still beating my head against the wall on this.
The docs aren't clear.

public class myComp extends Component
{

   @config
   @asStr
   property
   Buf(18) MAC_Addr

   virtual override void changed(Slot slot)
   {
      super.changed(slot)

      if (slot == myComp.MAC_Addr)
      {
         // do something?
      }
   }

}



... the docs say to call the changed method ... but when I do ... the VM crashes.

It seems as if I am calling changed within changed until I run out of memory on the stack.


================================================

Because buffer properties are accessed by reference, the framework has no knowledge when the buffer is modified. So it is the developer's responsibility to notify the framework of a buffer change via the Component.changed method (typically using a slot literal):

void updateBlob()
{
  blob.copyFromStr("wow!")
  changed(Foo.blob)
}

Note that changed is called automatically when setting primitive property types. You should only manually call changedfor Buf properties.

==========================================

... so if I were changing the slot within code ... I would manually call changed ...

... but what if the user changes it in the editor?

I still don't see how to make this work.

Any string entered in the editor (both Workbench ans SAE) never shows.

When I save the app and open in a text editor ... I see only part of my string.

Trying to create a sax (from the saved sab) results in:

==========================================

  ConvertAppFile [S:\apps\ABC.sab -> S:\apps\ABC.sax]

S:\apps\ABC.sab: Cannot load app file

java.lang.IllegalArgumentException: Invalid value for slot 'myKit::myComp.MAC_Addr' (strNotAscii)

        at sedona.Slot.assertValue(Slot.java:77)

        at sedona.Component.set(Component.java:210)

        at sedona.offline.OfflineComponent.decodeBinaryProps(OfflineComponent.java:435)

        at sedona.offline.OfflineComponent.decodeBinary(OfflineComponent.java:418)

        at sedona.offline.OfflineApp.decodeAppBinary(OfflineApp.java:588)

        at sedonac.steps.ConvertAppFile.run(ConvertAppFile.java:50)

        at sedonac.Compiler.appBinaryToXml(Compiler.java:252)

        at sedonac.Compiler.compile(Compiler.java:127)

        at sedonac.Main.doMain(Main.java:186)

        at sedonac.Main.main(Main.java:218)

*** FAILED with 1 error(s) and 0 warning(s) ***

Press any key to continue . . .








Murat Egrikavuk

unread,
May 21, 2017, 12:42:09 PM5/21/17
to sedo...@googlegroups.com

A wild guess:
- As your sab file has part of your string but gobble dee gook in front and,
- As you are seeing a strNotAscii error and,
- I assume you are not deliberately entering non-ascii characters,
I suspect your problem is somehow related to a text encoding issue. Are you working on a non-English system or windows version?
Mateusz Klatecki

To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+...@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+...@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+...@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+...@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+...@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.



--
Murat Egrikavuk
Ontrol A.S.

keith bradley

unread,
May 21, 2017, 9:19:05 PM5/21/17
to sedo...@googlegroups.com
I think I discovered the issue.
I am trying to pass the string from a Sys::Buf property slot to a native function:

myNative(MAC_Addr.toStr())

When I come back from the native ... the SYS::Buf property slot is clobbered somehow.

I guess I should create a limited scope sys::Buf and pass to it:

Buf temp(18) = MAC_Addr

myNative(temp.toStr())

This way I can get the string to native C.
After return ... it will be out of scope leaving the original slot untouched.

As it turns out the Sedona doc is not correct.

My 'changed()' callback is fired for the Sys::Buf prop slot when a user edits.
I never needed to force it to be called.

I guess you only need to manually call  changed() if you change in code.








Mateusz Klatecki

To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.

To post to this group, send email to sedo...@googlegroups.com.
Visit this group at https://groups.google.com/group/sedonadev.
For more options, visit https://groups.google.com/d/optout.
--
Murat Egrikavuk
Ontrol A.S.

--
You received this message because you are subscribed to the Google Groups "Sedona Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sedonadev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages