

#ifndef BlueSTSDK_BlueSTSDKFeatureCarryPosition_h
#define BlueSTSDK_BlueSTSDKFeatureCarryPosition_h

#import <Foundation/Foundation.h>
#import "BlueSTSDKFeature.h"
#import "BlueSTSDKFeatureField.h"

/**
 *  protocol used by the remote feature for extract the data
 *
 * @author STMicroelectronics - Central Labs.
 */
@protocol BlueSTSDKRemoteFeature <NSObject>

/**
 *  extract the data from a remote feature
 *
 *  @param timestamp data timestamp
 *  @param data      bytes to use for extract the data
 *  @param offset    number of bytes already read
 *
 *  @return data sample + number of byte read
 */
-(BlueSTSDKExtractResult*) extractRemoteData:(uint64_t)timestamp
                                        data:(NSData*)data
                                  dataOffset:(uint32_t)offset;

@end

/**
 *  Extend the BlueSTSDKFeature adding utitility method used for handle RemoteFeatures
 *
 * @author STMicroelectronics - Central Labs.
 */
@interface BlueSTSDKFeature(Remote)

/**
 *  extract the node id from a sample
 *
 *  @param sample sample with the data and the node id
 *  @param idPos  positition when the node id is stored
 *
 *  @return nodeId of the node that produced this sample
 */
+(uint16_t) getNodeId:(BlueSTSDKFeatureSample*)sample idPos:(uint32_t)idPos;

/**
 *  return the description for the nodeId field
 *
 *  @return description for the node id field
 */
+(BlueSTSDKFeatureField*) getNodeIdFieldDesc;

/**
 *  add a remoteId after the standard feature samples
 *
 *  @param remoteId id of the node that generate this sample
 *  @param sample   sample with the data
 *
 *  @return a new sample that contains also the node id
 */
+(BlueSTSDKFeatureSample*) appendRemoteId:(uint16_t)remoteId
                                   sample:(BlueSTSDKFeatureSample*)sample;

/**
 *
 *
 *  @param feature       feature that will extract the data
 *  @param nodeUnWrapper dictionary that contains the object fro unwrap the timestamp for each remote node
 *  @param timestamp     timestamp received from the node
 *  @param rawData       data recived from the node
 *  @param offset        number of byte already read
 *
 *  @return the sample and the number of byte read
 */
+(BlueSTSDKExtractResult*) extractRemoteData:(id<BlueSTSDKRemoteFeature>)feature
                                 unTsWrapper:(NSMutableDictionary *) nodeUnWrapper
                                   timestamp:(uint64_t)timestamp
                                        data:(NSData*)rawData
                                  dataOffset:(uint32_t)offset;
@end

#endif

