76 lines
3.8 KiB
Plaintext
76 lines
3.8 KiB
Plaintext
{
|
|
"comments": [
|
|
{
|
|
"unresolved": true,
|
|
"key": {
|
|
"uuid": "fbca309d_39ffd603",
|
|
"filename": "asterisk/AMI_Functions.ttcn",
|
|
"patchSetId": 2
|
|
},
|
|
"lineNbr": 109,
|
|
"author": {
|
|
"id": 1000010
|
|
},
|
|
"writtenOn": "2024-04-18T16:31:38Z",
|
|
"side": 1,
|
|
"message": "Looks like you could use TITAN\u0027s TEXT encoder for doing this:\n\n```\ntype record AMI_Field {\n\tcharstring\tkey,\n\tcharstring\tval\n} with {\n\tencode \"TEXT\"\n\tvariant \"SEPARATOR(\u0027:\u0027)\"\n};\n\ntype set of AMI_Field AMI_Msg with {\n\tencode \"TEXT\"\n\tvariant \"SEPARATOR(\u0027\\r\\n\u0027)\"\n\tvariant \"END(\u0027\\r\\n\u0027)\"\n};\n\nexternal function enc_AMI_Msg(in AMI_Msg msg) return charstring\n with { extension \"prototype(convert) encode(TEXT)\" }\nexternal function dec_AMI_Msg(in charstring stream) return AMI_Msg\n with { extension \"prototype(convert) decode(TEXT)\" }\n```\n\nSee https://gitlab.eclipse.org/eclipse/titan/titan.core/-/blob/master/usrguide/referenceguide/4-ttcn3_language_extensions.adoc?ref_type\u003dheads#user-content-text-encoder-and-decoder.\n\nNot saying you have to do it this way, but if we can offload some work to TITAN - why not.\n\nI have a small self-test:\n\n```\nprivate type component dummy_CT { };\n\ntestcase TC_tuwat() runs on dummy_CT {\n var AMI_Msg msg :\u003d { \n { \"field1\", \"value1\" },\n { \"field2\", \"value2\" }, \n { \"field3\", \"value3\" }\n }; \n\n var charstring text :\u003d enc_AMI_Msg(msg);\n log(\"AMI msg encoded: \", text);\n\n var AMI_Msg msg_dec :\u003d dec_AMI_Msg(text);\n log(\"AMI msg decoded: \", msg_dec);\n}\n```\n\nand here is the output it produces:\n\n```\nMTC@LEGION: AMI msg encoded: \"field1:value1\\r\\nfield2:value2\\r\\nfield3:value3\\r\\n\"\nMTC@LEGION: AMI msg decoded: { { key :\u003d \"field1\", val :\u003d \"value1\" }, { key :\u003d \"field2\", val :\u003d \"value2\" }, { key :\u003d \"field3\", val :\u003d \"value3\" } }\n```",
|
|
"range": {
|
|
"startLine": 109,
|
|
"startChar": 1,
|
|
"endLine": 109,
|
|
"endChar": 43
|
|
},
|
|
"revId": "54b614ad5d44c7c607e8e952b3596e4928e7c560",
|
|
"serverId": "035e6965-6537-41bd-912c-053f3cf69326"
|
|
},
|
|
{
|
|
"unresolved": true,
|
|
"key": {
|
|
"uuid": "0706ff2c_22efea22",
|
|
"filename": "asterisk/AMI_Functions.ttcn",
|
|
"patchSetId": 2
|
|
},
|
|
"lineNbr": 109,
|
|
"author": {
|
|
"id": 1000010
|
|
},
|
|
"writtenOn": "2024-04-18T16:32:09Z",
|
|
"side": 1,
|
|
"message": "Damn, I am late to the party :(",
|
|
"parentUuid": "fbca309d_39ffd603",
|
|
"range": {
|
|
"startLine": 109,
|
|
"startChar": 1,
|
|
"endLine": 109,
|
|
"endChar": 43
|
|
},
|
|
"revId": "54b614ad5d44c7c607e8e952b3596e4928e7c560",
|
|
"serverId": "035e6965-6537-41bd-912c-053f3cf69326"
|
|
},
|
|
{
|
|
"unresolved": true,
|
|
"key": {
|
|
"uuid": "eb4276c1_c703068e",
|
|
"filename": "asterisk/AMI_Functions.ttcn",
|
|
"patchSetId": 2
|
|
},
|
|
"lineNbr": 109,
|
|
"author": {
|
|
"id": 1000074
|
|
},
|
|
"writtenOn": "2024-04-18T17:39:14Z",
|
|
"side": 1,
|
|
"message": "I\u0027ll have a look tomorrow, thanks!",
|
|
"parentUuid": "0706ff2c_22efea22",
|
|
"range": {
|
|
"startLine": 109,
|
|
"startChar": 1,
|
|
"endLine": 109,
|
|
"endChar": 43
|
|
},
|
|
"revId": "54b614ad5d44c7c607e8e952b3596e4928e7c560",
|
|
"serverId": "035e6965-6537-41bd-912c-053f3cf69326"
|
|
}
|
|
],
|
|
"submitRequirementResults": []
|
|
} |