Revision 37cd5dc2 src/urt_topic.c

View differences:

src/urt_topic.c
50 50
 *
51 51
 * @param[in] topic  The topic to initialize. Must not be NULL.
52 52
 * @param[in] id  Unique, numeric identifier of the topic.
53
 * @param[in] mandatoryMessage Starting message of the topic. Must not be NULL.
53 54
 *
54 55
 * @return  Returns URT_STATUS_OK on success.
55 56
 *          Returns URT_STATUS_TOPIC_DUPLICATE if another topic with the same identifier already exists.
56 57
 */
57
urt_status_t urtTopicInit(urt_topic_t* topic, urt_topicid_t id)
58
urt_status_t urtTopicInit(urt_topic_t* topic, urt_topicid_t id, urt_message_t* mandatoryMessage)
58 59
{
60
  urtDebugAssert(topic);
61
  urtDebugAssert(mandatoryMessage);
62

  
59 63
  urt_topic_t.next = NULL;
60 64
  urt_topic_t.id = id;
61 65
  urtMutexInit(topic->lock);
62 66
  urtEventSourceInit(topic->evtSource);
63 67
  urt_topic_t.numHrtSubscribers = 0;
64 68
  urtCondvarInit(topic->hrtReleased);
65
  void* payload = NULL; //TODO: Replace
66
  urtMessageInit(topic->mandatoryMessage, payload);
69
  topic->mandatoryMessage = *mandatoryMessage;
67 70
  topic->latestMessage = &topic->mandatoryMessage;
68 71
  #if (URT_CFG_PUBSUB_QOS_RATECHECKS)
69 72
    urt_topic_t.hrtSubscribers = nullptr;

Also available in: Unified diff