I am newbie in the driver development so I want to know exactly what does the following line mean in Objective-C
[self sendMsg:[NSData msgWithID:kReqConfiguration subID:0 dest:kAddrThisPanelServer] :YES];
I am newbie in the driver development so I want to know exactly what does the following line mean in Objective-C
[self sendMsg:[NSData msgWithID:kReqConfiguration subID:0 dest:kAddrThisPanelServer] :YES];
It is a compound statement that can be broken into two statements
[self sendMsg:[NSData msgWithID:kReqConfiguration subID:0 dest:kAddrThisPanelServer] :YES];
becomes:
NSData *message = [NSData msgWithID:kReqConfiguration subID:0 dest:kAddrThisPanelServer];
[self sendMsg:message :YES];
But there is a convention problem with this code. While the method name does not have to be interspersed with arguments it is best practice to do so. In this case there is no method name part prior to the last ":", the method selector (signature) is:
sendMsg::
It would be better declared as:
- (void)sendMsg:(NSData *)msg option:(BOOL)option;
which would have the selector (signature):
sendMsg:option:
and the resulting call would be more understandable as:
NSData *message = [NSData msgWithID:kReqConfiguration subID:0 dest:kAddrThisPanelServer];
[self sendMsg:message option:YES];
What this means is that the method with the selector sendMsg:option:
of the same class instance is being called (sent the message) with the arguments message
and YES
.
[self sendMsg] .It is a way of calling a method in ios. With sendMsg specifying the name of the method to be called and self is the entity to call the method.