1

I want the below C structure to be implemented in python and want to have access to members as mentioned below. Any help is appreciated

typedef struct{
    unsigned int ch_state;
    unsigned int polling;
    unsigned int timeout;
    unsigned int count;
}channel_Status_t;

typedef struct{
 channel_Status_t  ch_status;
}channel_num_t

typedef struct{   
    channel_num_t SR1;
    channel_num_t SR2;
    channel_num_t LR1;
    channel_num_t LR2;
} channel_type_t;

channel_type_t Rx;
channel_type_t Tx;

Rx.SR1.ch_status.ch_state=1;
Rx.SR1.ch_status.polling=10;
Rx.SR1.ch_status.polling=20;
Rx.SR1.ch_status.count=0;

// Should be able to access data as below... 
Rx.SR2.ch_status.ch_state=1;
Rx.SR2.ch_status.polling=10;
Rx.SR2.ch_status.polling=20;
Rx.SR2.ch_status.count=0;

1 Answer 1

1

You most likely want to make a class out of each of those structs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.