Commit 82def4a5 authored by Maxime Perrotin's avatar Maxime Perrotin

Add Demo_Bright Ascension

parent 3420e26d
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
KAZOO=../../kazoo
all: c
c: test-parse-c # Polyorb_HI_C output
#cp skels/a/a.c output.pohic/a/C/src
#cp skels/b/b.c output.pohic/b/C/src
make -C output.pohic
test-parse-c: clean-c
$(KAZOO) -p --gw \
-o output.pohic \
--glue -g
buildsupport_pohic:
buildsupport -o output.buildsupport.pohic -p --aadlv2 --glue -i InterfaceView.aadl -c DeploymentView.aadl -d DataView.aadl ../common/ocarina_components.aadl ../common/TASTE_IV_Properties.aadl ../common/TASTE_DV_Properties.aadl
buildsupport_pohiada:
buildsupport -o output.buildsupport.ada --aadlv2 --glue -i InterfaceView.aadl -c DeploymentView.aadl -d DataView.aadl ../common/ocarina_components.aadl ../common/TASTE_IV_Properties.aadl ../common/TASTE_DV_Properties.aadl
gdb: clean
gdb --args $(KAZOO) --gw \
-o output.pohic \
--glue \
--debug
clean-c:
rm -rf output.pohic
skeletons:
$(KAZOO) -p --gw --glue -o code && make -C code dataview
clean-skeletons:
rm -rf code
clean: clean-c clean-skeletons
.PHONY: clean clean-c gdb test-parse-c buildsupport_pohic buildsupport_pohiada c skeletons clean-skeletons
/* Functions to be filled by the user (never overwritten by buildsupport tool) */
#include "action_service_adapter.h"
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#define MAX_USER_DATA_FIELD_LEN 222
void action_service_adapter_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
static void handleSubmitActionSubmit(const asn1SccT_MAL_msg_header *IN_hdr,
const asn1SccT_MO_userDataField *IN_msgBody)
{
asn1SccT_MAL_msg_header responseMsg = { .uriTo = 0};
asn1SccT_MO_userDataField responseBody = { .nCount = 0 };
// Skip decoding body, ground only ever sends the one action ID
asn1SccT_Int32 requestedActionID = 0;
// Call Dispatcher Interface
action_service_adapter_RI_submitAction(
&IN_hdr->uriTo,
&requestedActionID);
//Send Submit Ack
responseMsg.uriFrom = IN_hdr->uriTo;
responseMsg.timestamp = IN_hdr->timestamp; //TODO: time service
responseMsg.uriTo = IN_hdr->uriFrom;
responseMsg.interactionType = asn1Sccsubmit;
responseMsg.interactionStage = 2;
responseMsg.transactionId = IN_hdr->transactionId;
responseMsg.serviceArea = IN_hdr->serviceArea;
responseMsg.moService = IN_hdr->moService;
responseMsg.operation = IN_hdr->operation;
responseMsg.areaVersion = IN_hdr->areaVersion;
responseMsg.isErrorMsg = IN_hdr->isErrorMsg;
action_service_adapter_RI_transmitRequest(&responseMsg, &responseBody);
}
void action_service_adapter_PI_actionServiceReceiveIndication(
const asn1SccT_MAL_msg_header *IN_hdr,
const asn1SccT_MO_userDataField *IN_msgBody)
{
/* Dispatch according to operation type and interaction stage */
printf("[Action Service Adapter] Receive Indication\n");
// Operation numbers as specified in XML Service Specification
switch(IN_hdr->operation)
{
case 1:
//Submit Action
handleSubmitActionSubmit(IN_hdr, IN_msgBody);
break;
default:
printf("[Action Service Adapter] Unknown Operation\n");
}
}
/* This file was generated automatically: DO NOT MODIFY IT ! */
/* Declaration of the functions that have to be provided by the user */
#ifndef __USER_CODE_H_action_service_adapter__
#define __USER_CODE_H_action_service_adapter__
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void action_service_adapter_startup();
void action_service_adapter_PI_actionServiceReceiveIndication(const asn1SccT_MAL_msg_header *, const asn1SccT_MO_userDataField *);
extern void action_service_adapter_RI_transmitRequest(const asn1SccT_MAL_msg_header *, const asn1SccT_MO_userDataField *);
extern void action_service_adapter_RI_submitAction(const asn1SccT_apid *, const asn1SccT_Int32 *);
#ifdef __cplusplus
}
#endif
#endif
/* Functions to be filled by the user (never overwritten by buildsupport tool) */
#include "action_service_dispatch.h"
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
void action_service_dispatch_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
void action_service_dispatch_PI_submitAction(const asn1SccT_apid *IN_providerid,
const asn1SccT_Int32 *IN_actionid)
{
switch(*IN_providerid)
{
case 109:
printf("[Action Service Dispatch] Call mode manager container submit action\n");
action_service_dispatch_RI_submitAction(IN_actionid);
break;
}
}
/* This file was generated automatically: DO NOT MODIFY IT ! */
/* Declaration of the functions that have to be provided by the user */
#ifndef __USER_CODE_H_action_service_dispatch__
#define __USER_CODE_H_action_service_dispatch__
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void action_service_dispatch_startup();
void action_service_dispatch_PI_submitAction(const asn1SccT_apid *, const asn1SccT_Int32 *);
extern void action_service_dispatch_RI_submitAction(const asn1SccT_Int32 *);
#ifdef __cplusplus
}
#endif
#endif
/* This file was generated automatically: DO NOT MODIFY IT ! */
/* Declaration of the functions that have to be provided by the user */
#ifndef __USER_CODE_H_aggregation_service_adapter__
#define __USER_CODE_H_aggregation_service_adapter__
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void aggregation_service_adapter_startup();
void aggregation_service_adapter_PI_aggrServiceReceiveIndication(const asn1SccT_MAL_msg_header *, const asn1SccT_MO_userDataField *);
void aggregation_service_adapter_PI_monitorValueNotify(const asn1SccT_apid *, const asn1SccT_Int32 *, const asn1SccT_MO_AggregationValue *);
extern void aggregation_service_adapter_RI_transmitRequest(const asn1SccT_MAL_msg_header *, const asn1SccT_MO_userDataField *);
extern void aggregation_service_adapter_RI_enableGeneration(const asn1SccT_apid *, const asn1SccT_InstanceBooleanPairList *);
extern void aggregation_service_adapter_RI_monitorValueRegister(const asn1SccT_apid *, const asn1SccT_apid *, const asn1SccT_String *);
extern void aggregation_service_adapter_RI_monitorValueDeregister(const asn1SccT_apid *, const asn1SccT_apid *, const asn1SccT_String *);
extern void aggregation_service_adapter_RI_getValue(const asn1SccT_apid *, const asn1SccT_Int32List *, asn1SccT_MO_AggregationValueList *);
#ifdef __cplusplus
}
#endif
#endif
/* Functions to be filled by the user (never overwritten by buildsupport tool) */
#include "aggregation_service_dispatch.h"
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
void aggregation_service_dispatch_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
void aggregation_service_dispatch_PI_monitorValueNotify(const asn1SccT_apid *IN_consumerID,
const asn1SccT_Int32 *IN_aggregationID,
const asn1SccT_MO_AggregationValue *IN_aggregationValue)
{
printf("[Aggregation Service Dispatch] Notification received\n");
//switch on consumer id whether we are going MO or PUS stack
switch(*IN_consumerID)
{
case 106:
printf("[Aggregation Service Dispatch] Dispatch to MO\n");
aggregation_service_dispatch_RI_publishMO(IN_consumerID, IN_aggregationID, IN_aggregationValue);
break;
case 2042:
printf("[Aggregation Service Dispatch] Dispatch to PUS\n");
aggregation_service_dispatch_RI_publishPUS(IN_consumerID, IN_aggregationID, IN_aggregationValue);
break;
}
}
void aggregation_service_dispatch_PI_enableGeneration(const asn1SccT_apid *IN_providerId,
const asn1SccT_InstanceBooleanPairList *IN_enableInstances)
{
printf("[Aggregation Service Dispatch] Call EnableGeneration\n");
aggregation_service_dispatch_RI_aggrServiceEnableGeneration(IN_enableInstances);
}
void aggregation_service_dispatch_PI_getValue(const asn1SccT_apid *IN_providerId,
const asn1SccT_Int32List *IN_aggInstIDs,
asn1SccT_MO_AggregationValueList *OUT_aggrValues)
{
printf("[Aggregation Service Dispatch] Call GetAggregationValue\n");
aggregation_service_dispatch_RI_aggrServiceGetValue(IN_aggInstIDs, OUT_aggrValues);
}
void aggregation_service_dispatch_PI_monitorValueRegister(const asn1SccT_apid *IN_providerId,
const asn1SccT_apid *IN_consumerID,
const asn1SccT_String *IN_subscriptionID)
{
printf("[Aggregation Service Dispatch] Call Register\n");
aggregation_service_dispatch_RI_aggrServiceProvidermonitorValueRegister(IN_consumerID, IN_subscriptionID);
}
void aggregation_service_dispatch_PI_monitorValueDeregister(const asn1SccT_apid *IN_providerId,
const asn1SccT_apid *IN_consumerID,
const asn1SccT_String *IN_subscriptionID)
{
printf("[Aggregation Service Dispatch] Call Deregister\n");
aggregation_service_dispatch_RI_aggrServiceProviderMonitorValueDeregister(IN_consumerID, IN_subscriptionID);
}
/* This file was generated automatically: DO NOT MODIFY IT ! */
/* Declaration of the functions that have to be provided by the user */
#ifndef __USER_CODE_H_aggregation_service_dispatch__
#define __USER_CODE_H_aggregation_service_dispatch__
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void aggregation_service_dispatch_startup();
void aggregation_service_dispatch_PI_enableGeneration(const asn1SccT_apid *, const asn1SccT_InstanceBooleanPairList *);
void aggregation_service_dispatch_PI_monitorValueNotify(const asn1SccT_apid *, const asn1SccT_Int32 *, const asn1SccT_MO_AggregationValue *);
void aggregation_service_dispatch_PI_getValue(const asn1SccT_apid *, const asn1SccT_Int32List *, asn1SccT_MO_AggregationValueList *);
void aggregation_service_dispatch_PI_monitorValueRegister(const asn1SccT_apid *, const asn1SccT_apid *, const asn1SccT_String *);
void aggregation_service_dispatch_PI_monitorValueDeregister(const asn1SccT_apid *, const asn1SccT_apid *, const asn1SccT_String *);
extern void aggregation_service_dispatch_RI_aggrServiceEnableGeneration(const asn1SccT_InstanceBooleanPairList *);
extern void aggregation_service_dispatch_RI_publishMO(const asn1SccT_apid *, const asn1SccT_Int32 *, const asn1SccT_MO_AggregationValue *);
extern void aggregation_service_dispatch_RI_publishPUS(const asn1SccT_apid *, const asn1SccT_Int32 *, const asn1SccT_MO_AggregationValue *);
extern void aggregation_service_dispatch_RI_aggrServiceGetValue(const asn1SccT_Int32List *, asn1SccT_MO_AggregationValueList *);
extern void aggregation_service_dispatch_RI_aggrServiceProvidermonitorValueRegister(const asn1SccT_apid *, const asn1SccT_String *);
extern void aggregation_service_dispatch_RI_aggrServiceProviderMonitorValueDeregister(const asn1SccT_apid *, const asn1SccT_String *);
#ifdef __cplusplus
}
#endif
#endif
/* Functions to be filled by the user (never overwritten by buildsupport tool) */
#include "aggregation_service_provider.h"
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <assert.h>
#define NUM_AGGRS 2LL
#define NUM_SUBSCRIBERS 2LL
typedef struct {
asn1SccT_apid consumerID;
asn1SccT_Boolean registeredAggregations[NUM_AGGRS];
}subscriptionList;
// Fills the role of both container and provider for aggregation service. Part of the execution platfrom
static subscriptionList subscriptions[NUM_SUBSCRIBERS] = {
{.consumerID = 106, .registeredAggregations = {0, 0} },
{.consumerID = 2042, .registeredAggregations = {1, 0} }
};
static asn1SccT_Int32 instIdInc = 0x016B00;
// Static aggregation definitions
static asn1SccT_MO_AggregationDefinitionDetails aggregations[NUM_AGGRS] = {
// mode and Gyro temp
{ .objectInstID = 0x6B00, .related = { .objectInstID = 0x6B10, .objectName = {.arr = "housekeeping"} }, .generationEnabled = 0,
.parameterSets = { .nCount = 1, .arr = { {.parameters = {.nCount = 2, .arr = {0x6500, 0x7801} } } } } },
{ .objectInstID = 0x6B01, .related = { .objectInstID = 0x6B10, .objectName = {.arr = "diagnostic"} }, .generationEnabled = 0,
.parameterSets = { .nCount = 1, .arr = { {.parameters = {.nCount = 3, .arr = {0x6500, 0x7800, 0x7801} } } } } },
};
void aggregation_service_provider_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
void aggregation_service_provider_PI_enableGeneration(const asn1SccT_InstanceBooleanPairList *IN_enableInstances)
{
int i;
for(i = 0; i < IN_enableInstances->nCount; i++)
{
printf("[Aggregation Service] %s generation of aggregation: %lld\n",
IN_enableInstances->arr[i].value ? "Enable":"Disable",
IN_enableInstances->arr[i].id);
aggregations[IN_enableInstances->arr[i].id].generationEnabled = IN_enableInstances->arr[i].value;
}
}
static void populateAggrVal(int aggrDefNum,
asn1SccT_MO_AggregationValue *OUT_aggrValue)
{
int i;
asn1SccT_apid providerID;
asn1SccT_Int32 parameterID;
asn1SccT_MO_ParameterValue parameterValue;
asn1SccT_MO_ErrorCodes exceptionCode;
OUT_aggrValue->objectInstID = instIdInc++;
OUT_aggrValue->related = aggregations[aggrDefNum];
// aggregation value contains a list of aggregation sets: a duration/list of parametervalues pair
// We only ever have a single aggregation set per parameter value in this demo
asn1SccT_MO_AggregationSetValue *pAggregationSet = OUT_aggrValue->values.arr;
OUT_aggrValue->values.nCount = 1;
pAggregationSet->deltaTime= (asn1SccT_UnsegmentedTime) {1,2,3,4}; // Place holder. No Time service available
pAggregationSet->values.nCount = aggregations[aggrDefNum].parameterSets.arr[0].parameters.nCount;
asn1SccT_MO_ParameterValue *pParameterSet = pAggregationSet->values.arr;
// call parameter service gets for aggregation service parameters
for(i = 0; i < pAggregationSet->values.nCount; i++)
{
providerID = aggregations[aggrDefNum].parameterSets.arr[0].parameters.arr[i] >> 8;
parameterID = aggregations[aggrDefNum].parameterSets.arr[0].parameters.arr[i] & 0xFF;
printf("[Aggregation Service] Get Parameter: ProviderID: %lld ParameterID: %lld \n", providerID, parameterID);
aggregation_service_provider_RI_paramServiceGetValue(&providerID,
&parameterID,
pParameterSet + i,
&exceptionCode);
printf("[Aggregation Service] Got Value: %lld \n", pParameterSet[i].rawValue);
}
}
void aggregation_service_provider_PI_update()
{
// Send notification for enabled aggregations:
asn1SccT_MO_AggregationValue aggrValue = {0};
int i, j;
asn1SccT_Int32 aggrID;
for(i = 0; i < NUM_AGGRS; i++)
{
if(aggregations[i].generationEnabled)
{
// fill out aggregation value struct
populateAggrVal(i, &aggrValue);
// for each registered subscriber, send a notification to dispatcher
// subscribers are static. one to PUS, one to MO.
// PUS side only receives housekeeping aggregation
for(j = 0; j < NUM_SUBSCRIBERS; j++)
{
if(subscriptions[j].registeredAggregations[i])
{
aggrID = i;
printf("[Aggregation Service] Notify Subscriber: %lld Aggregation: %d\n", subscriptions[j].consumerID, i);
aggregation_service_provider_RI_monitorValueNotify(&subscriptions[j].consumerID,
&aggrID,
&aggrValue);
}
}
}
}
}
void aggregation_service_provider_PI_getValue(const asn1SccT_Int32List *IN_aggrIDs,
asn1SccT_MO_AggregationValueList *OUT_aggrValues)
{
int i = 0;
asn1SccT_MO_AggregationValue *pAggrValue = OUT_aggrValues->arr;
// Switch on provided aggregation ID, call parameter service gets for required parameters
printf("[Aggregation Service] Get Aggregation Values. Count: %d\n", IN_aggrIDs->nCount);
for(i = 0; i < IN_aggrIDs->nCount; i++)
{
if((IN_aggrIDs->arr[i]) < NUM_AGGRS)
{
//Valid aggregation id
printf("[Aggregation Service] Get Aggregation Value: %lld\n", IN_aggrIDs->arr[i]);
populateAggrVal(IN_aggrIDs->arr[i], pAggrValue + i);
}
}
OUT_aggrValues->nCount = IN_aggrIDs->nCount;
}
void aggregation_service_provider_PI_monitorValueRegister(const asn1SccT_apid *IN_consumerID,
const asn1SccT_String * IN_subscriptionID)
{
printf("[Aggregation Service] Register Subscription for Consumer: %lld\n", *IN_consumerID);
//Only one MO subscriber, always registers wildcard
subscriptions[0].registeredAggregations[0] = 1;
subscriptions[0].registeredAggregations[1] = 1;
}
void aggregation_service_provider_PI_monitorValueDeregister(const asn1SccT_apid *IN_consumerID,
const asn1SccT_String *IN_subscriptionID)
{
printf("[Aggregation Service] Deregister Subscription for Consumer: %lld\n", *IN_consumerID);
//Ground never calls deregister.
subscriptions[0].registeredAggregations[0] = 0;
subscriptions[0].registeredAggregations[1] = 0;
}
void aggregation_service_provider_PI_parameterReportingGroupEnable(const asn1SccT_Int32 *groupID,
const asn1SccT_Boolean *enable)
{
aggregations[*groupID].generationEnabled = enable != 0 ? 1 : 0;
}
/* This file was generated automatically: DO NOT MODIFY IT ! */
/* Declaration of the functions that have to be provided by the user */
#ifndef __USER_CODE_H_aggregation_service_provider__
#define __USER_CODE_H_aggregation_service_provider__
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void aggregation_service_provider_startup();
void aggregation_service_provider_PI_enableGeneration(const asn1SccT_InstanceBooleanPairList *);
void aggregation_service_provider_PI_update();
void aggregation_service_provider_PI_getValue(const asn1SccT_Int32List *, asn1SccT_MO_AggregationValueList *);
void aggregation_service_provider_PI_monitorValueRegister(const asn1SccT_apid *, const asn1SccT_String *);
void aggregation_service_provider_PI_monitorValueDeregister(const asn1SccT_apid *, const asn1SccT_String *);
void aggregation_service_provider_PI_parameterReportingGroupEnable(const asn1SccT_Int32 *, const asn1SccT_Boolean *);
extern void aggregation_service_provider_RI_monitorValueNotify(const asn1SccT_apid *, const asn1SccT_Int32 *, const asn1SccT_MO_AggregationValue *);
extern void aggregation_service_provider_RI_paramServiceGetValue(const asn1SccT_apid *, const asn1SccT_Int32 *, asn1SccT_MO_ParameterValue *, asn1SccT_MO_ErrorCodes *);
#ifdef __cplusplus
}
#endif
#endif
/* Functions to be filled by the user (never overwritten by buildsupport tool) */
#include "alert_service_adapter.h"
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#define MAX_USER_DATA_FIELD_LEN 222
void alert_service_adapter_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
static void decodeEnableGenerationSubmitBody(const asn1SccT_MO_userDataField *IN_msgBody,
asn1SccT_InstanceBooleanPairList *OUT_enableInstances)
{
BitStream bitStrm;