summaryrefslogtreecommitdiff
path: root/riff/SequenceFactory.h
blob: a208f902fb90a20681e2a3002819324ff6ecb0c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
 * SequenceFactory.h
 *
 * Copyright (C) ST-Ericsson SA 2011
 * Authors: Srimanta Panda <srimanta.panda@stericsson.com>,
 *          Ola Borgelin <ola.borgelin@stericsson.com>,
 *          Karin Hedlund <karin.hedlund@stericsson.com>,
 *          Markus Andersson <markus.m.andersson@stericsson.com> for ST-Ericsson.
 * License terms: 3-clause BSD license
 *
 */

/*
 * @addtogroup SequenceFactory
 * @{
 *
 * Setup execution sequence for different mode (erase/flash).
 */

#pragma once
#include "Config.h"
#include <vector>

// Command class forward declaration
class Command;

typedef std::vector<Command*> CommandSequence_t;

class SequenceFactory
{
public:
    /**
     * @brief Sequence ID.
     */
    enum SequenceId {
        BOARD_FLASH,       	/**< Board flash sequence.>  */
        BOARD_ERASE,        /**< Board erase sequence. > */
        BOARD_DUMP			/**< Board dump sequence. > */
    };

    /**
     * @brief Protocol type.
     */
    enum UseBulk {
        USE_COMMAND_PROTOCOL,       /**< Use command protocol. > */
        USE_BULK_PROTOCOL           /**< Use bulk protocol. > */
    };

    /**
     * @brief Delete buffer mode.
     */
    enum DeleteBuffer {
        DELETE_BUFFER_NO,       /**< Don't delete buffer. > */
        DELETE_BUFFER_YES       /**< Delete buffer. > */
    };

    /**
     * @brief Get new command sequence for the specified sequence ID.
     *
     * @param[in] id - ID of the sequence.
     * @return Newly created command sequence.
     */
    static CommandSequence_t getSequence(SequenceId id);

    /**
     * @brief Get new command sequence for the sequence ID specified in the profile.
     *
     * @return Newly created command sequence.
     */
    static CommandSequence_t getProfileSequence();

    /**
     *
     */
    static void setArguments(const char* configPath, const char* mode, const char* flashImg, const char* address, const char* length, const char* dumpPath);

    static const char* configPath_;
    static const char* flashmode_;
    static const char* flashImgPath_;
    static const char* dumpHostPath_;
    static int address_;
    static int length_;
private:
    SequenceFactory();
    SequenceFactory(const SequenceFactory&);
    ~SequenceFactory();

    static const SequenceId defaultSequence_;

};

/* @} */