jpaulm / parsefbp

Simple parser for .fbp notation written in JavaScript, generating JSON
10 stars 1 forks source link

Can't Decode Node metadata #7

Open fancymax opened 8 years ago

fancymax commented 8 years ago

for example:

'1' -> MeasID reader1(RealTimeDataSource:x=50,y=100)

//Can't decode x=50,y=100

FYI

jpaulm commented 8 years ago

I am only expecting the .fbp notation described in Readme, which does not support metadata on the component (strange place to put it, IMO!). If you could show some JSON you expect the metadata to generate, I could add that logic in to parsefbp.

TIA

fancymax commented 8 years ago

thanks very much.

'1' -> MeasID reader1(RealTimeDataSource:x=50,y=100) 

now will be decode like this:

"component": "RealTimeDataSource:x=50,y=100"

maybe it should erase ":x=50,y=100" then decode like below?

"component": "RealTimeDataSource"
fancymax commented 8 years ago

or maybe it can be decode like this:

  "processes": {
    "reader1": {
      "component": "RealTimeDataSource",
      "metadata": {
        "x": 50,
        "y": 100
      }
    },
jpaulm commented 8 years ago

Maybe I'll go with this one... I'll let you know when it's done. Thanks.

On Sun, Jan 24, 2016 at 10:02 PM, max lin notifications@github.com wrote:

or maybe it can be decode like this:

"processes": { "reader1": { "component": "RealTimeDataSource", "metadata": { "x": 50, "y": 100 } },

— Reply to this email directly or view it on GitHub https://github.com/jpaulm/parsefbp/issues/7#issuecomment-174381829.

jpaulm commented 8 years ago

I think it works (latest commit) - give it a try! However npm test hasn't been updated yet - will do that in the next few days.

fancymax commented 8 years ago

Thanks very much, it works right.

And it decode

"component": "RealTimeDataSource:x=50,y=100,z=30"

like this, it erase z=30, which is OK.

  "processes": {
    "reader1": {
      "component": "RealTimeDataSource",
      "metadata": {
        "x": 50,
        "y": 100
      }
    },

Recently I use your wonderful fbp runtime to extend my Energy Management system’s power. My original system is written by C++&C#,So I choose to use csharpfbp + parsefbp.

Thanks Again.

jpaulm commented 8 years ago

@fancymax You're welcome! When there is no metadata on a component, I generate "metadata": {} - hope that's OK, as I couldn't figure out a way to suppress it!

I have also updated the expected json output so npm test gives correct results - seems to work!

I will update the Readme shortly.

Sorry, did you want a "z" as well, if specified? I can add that easily...

Cheers

fancymax commented 8 years ago

No thanks,"x", "y" is enough~

jpaulm commented 8 years ago

OK Thanks for getting back to me!

Paul M.

On Thu, Jan 28, 2016 at 7:29 PM, max lin notifications@github.com wrote:

No thanks,"x", "y" is enough~

— Reply to this email directly or view it on GitHub https://github.com/jpaulm/parsefbp/issues/7#issuecomment-176495764.

jpaulm commented 8 years ago

I saw you said, "My original system is written by C++&C#,So I choose to use csharpfbp + parsefbp." How do you get C++ and C# to talk to each other - and where does parsefbp fit in? As parsefbp is written in JavaScript, does this mean this is on the client side and the others are on the server side?

Just curious! All the best,

Paul M.